This is the theme template for ScissorHands.NET, which provides the basic theme structure.
This is the overall structure of the theme.
.
└── src/
├── assets/
│ ├── css/
│ │ └── theme.css
│ ├── images/
│ │ └── logo.png
│ └── js/
│ └── theme.js
│
├── favicon.ico
│
├── theme.json
│
├── _Imports.razor
├── MainLayout.razor
├── IndexView.razor
├── PostView.razor
├── PageView.razor
└── NotFoundView.razor
IMPORTANT: It's strongly recommended to place all the theme files under the
srcdirectory for better local testing purpose.
-
theme.jsondefines the metadata of the theme.You can have one or more CSS and JavaScript files. If you choose to do so, make sure to include them all in this
theme.json.
- Set up namespace of your theme.
- Examples:
@namespace MyScissorHands.Theme.AwesomeTemplate
-
This is the overall HTML layout structure.
-
It calls both UI components and plugin components.
-
To change the way of displaying the
@PageTitlevalue, override theCalculatePageTitle()method:@code { protected override string CalculatePageTitle() { // ADD LOGIC HERE } }
-
To change the way of displaying the
@PageDescriptionvalue, override theCalculatePageDescription()method:@code { protected override string CalculatePageDescription() { // ADD LOGIC HERE } }
-
To change the way of displaying the
@PageLocalevalue, override theCalculatePageLocale()method:@code { protected override string CalculatePageLocale() { // ADD LOGIC HERE } }
- This is the landing page of your static website.
- This is the blog post page.
- This is the non-blog post page.
- Feel free to add extra UI components for each layout and page components.
- The list of UI components are below but not limited to:
- Header
- Footer
- Sidebar
- Navigation
- Widgets
- It's recommended to follow the default naming convention like
theme.cssandtheme.js. - If you prefer multiple CSS and JavaScript files, feel free to do so.
- Make sure to include all CSS and JavaScript files in
theme.jsonso that they're properly loaded.
- Make sure to include all CSS and JavaScript files in
-
Set environment variables for GitHub NuGet Package Registry.
# zsh/bash source ./scripts/setup-gh-auth.sh --username "<GITHUB_USERNAME>" --token "<GITHUB_TOKEN>"
# PowerShell . ./scripts/setup-gh-auth.ps1 -Username "<GITHUB_USERNAME>" -Token "<GITHUB_TOKEN>"
NOTE: Make sure to sourcing the script instead of executing it.
-
Create a console app project by following the Getting Started section of ScissorHands.NET.
-
Add
appsettings.jsonthat defines the site manifest and plugin manifest.{ "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } }, "Site": { "Title": "ScissorHands.NET – Theme Template", "Description": "Theme template for ScissorHands.NET static site generator.", "Author": "ScissorHands Team", "Theme": "theme-template" }, "Plugins": [ { "Name": "My Awesome Plugin", "Options": { "Option1": true, "Option2": "lorem ipsum", "Option3": 100 } } ] } -
Create a symbolic link under the
themesdirectory. Make sure that the symbolic directory should follow the theme's slug. -
Add a couple of markdown files representing both blog posts and pages.
-
Run the blog app.
dotnet run -- --preview
-
Verify the generated HTML properly renders your theme.
{ "name": "Theme Template", "version": "1.0.0", "description": "A theme template for ScissorHands.NET", "slug": "theme-template", "stylesheets": [ "/assets/css/theme.css" ], "scripts": [ "/assets/js/theme.js" ] }