Themes and Templates
Themes ¶
Themes are simply sets of assets like css and templates. These are grouped into named folders. Using a theme means declaring the name of the theme directory in the settings file. See “theme-name” in site settings.
Templates ¶
Using the Go templating format.
Debugging problems in Go templates can be frustrating. Forget the final “{{end}}” in your conditions? Yeah, Go is gonna explode without much help. Use what I’ve put in demo generated by “go-magnet new” as a starting point.
In the source code, see structs.go particularly PageData and Pagination structs for specifics, as well as the Post struct.
PageData ¶
When a page is built using a template, magnet populates some PageData for you to use in the templates.
https://codeberg.org/83h3m07h/go-magnet/src/branch/master/structs.go#L84
Author ¶
String. Author name.
Endpoint ¶
String. Possible values:
+ “tag”
+ “rss-tag”
+ “author”
+ “rss-author”
+ “post”
+ “custom”
+ “home”
+ “rss-home”
+ “archive”
MagnetURL ¶
String. URL to the git repo.
PageName ¶
String. A title if there is one.
PageTags ¶
[]Strings. A list of unique tags contained in the entries of this page.
PageTitle ¶
String. The SiteName and relevant string.
Pagination ¶
Struct Pagination. See Pagination in structs.
Posts ¶
[]Post. A list of Posts. See Post in structs.
SiteName ¶
String. Set by settings.SiteName
SiteRemoteAddress ¶
String. Set by settings.SiteRemoteAddress
Tag ¶
String. The currently set Tag if any.
TagsByName ¶
[]Name,Count. A list of tag names and the number of items with it ordered by its Name.
TagsByCount ¶
[]Name,Count. A list of tag names and the number of items with it ordered by Count.
ThemeName ¶
String. The name of the theme.
Version ¶
String. The go-magnet version.