Skip to content

Commit

Permalink
Make theme configurable (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
petervandenhout authored Aug 11, 2019
1 parent 4d0caa6 commit 505c1f9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/Opw.PineBlog.Abstractions/PineBlogOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ public class PineBlogOptions
/// </summary>
public string Version { get; set; }

/// <summary>
/// The theme for the blog, defaults to "default".
/// </summary>
public string Theme { get; set; } = "default";

/// <summary>
/// Cover URL.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
@{
Layout = "_Layout";
var theme = ViewData["PineBlogTheme"];
}
@section head {
<environment include="Development">
<link rel="stylesheet" href="~/themes/default/css/theme.css">
<link rel="stylesheet" href="~/themes/@theme/css/theme.css">
</environment>
<environment exclude="Development">
<link rel="stylesheet" href="~/themes/default/css/theme.min.css" asp-append-version="true">
<link rel="stylesheet" href="~/themes/@theme/css/theme.min.css" asp-append-version="true">
</environment>
@RenderSection("head", required: false)
}
@section scripts {
<partial name="_ValidationScriptsPartial" />
<environment include="Development">
<script src="~/themes/default/js/theme.min.js" asp-append-version="true"></script>
<script src="~/themes/@theme/js/theme.min.js" asp-append-version="true"></script>
</environment>
<environment exclude="Development">
<script src="~/themes/default/js/theme.min.js" asp-append-version="true"></script>
<script src="~/themes/@theme/js/theme.min.js" asp-append-version="true"></script>
</environment>
@RenderSection("scripts", required: false)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public async Task OnPageHandlerExecutionAsync(PageHandlerExecutingContext contex
}

pageModel.ViewData["PineBlogVersion"] = _options.Value.Version;
pageModel.ViewData["PineBlogTheme"] = _options.Value.Theme;
pageModel.ViewData["Title"] = _options.Value.Title;

await next();
Expand Down

0 comments on commit 505c1f9

Please sign in to comment.