Skip to content

4. Designing a theme

Mark Downie edited this page Jan 3, 2023 · 23 revisions

DasBlog Core uses a templating system based on the Razor Engine to define the layouts of each theme. Each unique theme is contained in a folder in the Themes folder, to update your Theme navigate to the Site Admin page.

You can create a new theme called "rainbow", for example, with the CLI as follows:

dasblog-core newtheme rainbow

You can then update the site theme to "rainbow":

dasblog-core config theme rainbow

For Linux based deploys execute the following via SSH:

dotnet dasblog-core.dll newtheme rainbow

dotnet dasblog-core.dll config theme rainbow

You can also create a theme manually by creating a new folder with the following elements (you can start by copying them from an existing theme):

  • _Layout.cshtml - Top level master page template for the entire site.
  • _BlogPage.cshtml - Layout of the blog home page and, dependent on settings, allows multiple posts to be listed.
  • _BlogItem.cshtml - Layout of an individual blog post
  • custom.css - Used to apply additional transformation to override the default site CSS. For example, you can go to a site Boot strap them site like Bootswatch and add the CSS directly to custom.css.

alt text

The number of posts you can view on the home page is defined by the Front Page Entry Count in admin/settings.

Modifying the look of the home page

Optionally if you want a differing design aesthetic for the home page you might also consider enabling the Show item Summary in aggregated views in admin/settings. This enables the following layout on the home page:

  • _Layout.cshtml - Top level template for all views in the theme
  • _BlogItemSummary.cshtml - Layout of an individual summary blog post
  • _BlogPageSummary.cshtml - Layout of the blog home page in the Summary format

alt text

Note: All supporting Views (outside the Themes folder) assume the use of bootstrap, this may not work for everyone. If you need to override any other Views (e.g. category, archive) they can be copied into your Themes folder and modified as necessary. DasBlog Core will always check your Themes folder first for Views to use.

Additional questions?

If you have additional questions or concerns please submit an issue.