diff --git a/README.md b/README.md index ecf3217..2a5ac0b 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,12 @@ summaryLength = 70 # number of words for article summaries extraContentDirs = [] # other content directories to render similarly to the home page showcaseDir = "showcase" # create a content directory that shows a special showcase section in the home page + # shows a specified single page as a home page, instead of the traditional articles list + # requires setting `homeSinglePage` + # goes well with extraContentDirs + showSinglePageAsHome = false + homeSinglePage = "/home" + # It's best to put these icons in the "static" folder of your site logo = "/logo.svg" favicon = "/favicon.png" # 32x32 @@ -51,6 +57,8 @@ summaryLength = 70 # number of words for article summaries svgicon = "/logo.svg" icon512 = "/icon512.png" # 512x512 png image + logoRightOfTitle = false # positions the logo to the right of the title; default: false + showTags = true # show the Tags menu item; default true showRss = true # show the link for the RSS feed; default true @@ -99,7 +107,12 @@ summaryLength = 70 # number of words for article summaries plausibleScriptUrl = "https://something.com/..." plausibleDomain = "example.com" + # enable analytics using Umami + umamiScriptUrl = "https://something.com/..." + umamiWebsiteId = "example-tracking-code" + enableShareOnFediverse = false # enable a button at the end of an article to share it on the fediverse + tocBeforeImage = false # show the table of contents before the main article image; default false # WARNING: deprecated! Use [[menu.icons]] instead, look below # links = [ @@ -246,9 +259,12 @@ Every post can have various parameters in the frontmatter, here are some that yo - `description`: a brief description of the post, useful for SEO optimization - `tags`: an array of tags, useful for searching similar articles - `image`: a link to a feature image for the article, shown in the preview as well +- `imageCaption`: a markdown text rendered as a caption for the article image described above - `featured`: boolean, indicate if the post should be shown as featured - `comments`: boolean, if true it enables comments for the current post, if false it disables them (default is true) - `showDate`: boolean, true by default, if false hides the date. Useful for non-article pages where the date isn't important +- `showTitle`: boolean, true by default, if false hides the title. +- `showShare`: boolean, true by default, if false hides the share button. - `norss`: boolean, if set to true the page will be skipped in the rss feed - `nosearch`: boolean, if set to true the page won't show up in searches - `toc`: boolean, if set to true a table of contents will be shown for the article diff --git a/assets/feed_style.xsl b/assets/feed_style.xsl new file mode 100644 index 0000000..3ed58f5 --- /dev/null +++ b/assets/feed_style.xsl @@ -0,0 +1,84 @@ + + + + + + + <xsl:value-of select="/rss/channel/title"/> RSS Feed + + + + {{ $style := resources.Get "/scss/style.scss" | resources.ExecuteAsTemplate "/scss/style.scss" . | resources.ToCSS (dict "targetPath" "css/styles.css" "outputStyle" "compressed" "enableSourceMap" "true") | resources.Fingerprint "sha512" }} + + + + +
+

+ + +

+
+

This is a web feed, also known as an RSS feed. Subscribe by copying the URL into your RSS reader.

+
+
+
+ +
+ +
+
+
+
+

📄 Recent Posts

+ +
+

+ +
+
+
+
+ + +
+
diff --git a/assets/scss/style.scss b/assets/scss/style.scss index cd76151..c832385 100644 --- a/assets/scss/style.scss +++ b/assets/scss/style.scss @@ -586,6 +586,15 @@ ul.list { font-weight: normal; font-size: 1.6 * $base_font_size * $title_font_mult; margin: 0; + {{ if site.Params.logoRightOfTitle }} + display: flex; + flex-direction: row; + flex-wrap: wrap; + align-items: center; + > a { + margin-right: 12px; + } + {{ end }} } img { @@ -915,7 +924,7 @@ header.jumbotronContainer { color: var(--default_fg) !important; } #main-nav a, .nerdlink:hover { - color: var(--default_accent) !important; + color: var(--default_fg) !important; } .nerdlink span { color: var(--default_fg) !important; @@ -1075,13 +1084,13 @@ header.jumbotronContainer { max-width: 100vw; min-width: 200px; } - h1 { + h2 { font-weight: 300; &.huge { font-size: 4 * $base_font_size * $title_font_mult; } } - h1, h2 { + h2, h3 { margin: 12px; } ul { @@ -1112,7 +1121,7 @@ header.jumbotronContainer { h1.huge { font-size: 3 * $base_font_size * $title_font_mult !important; } - h1, h2 { + h2, h3 { margin: 6px; } } diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index ec073c1..3b2bc96 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,6 +1,7 @@ {{- partial "head.html" . -}} + {{- partial "build_assets.html" . -}}
{{- partial "header.html" . -}} @@ -14,6 +15,7 @@
{{- partial "plausible.html" . -}} + {{- partial "umami.html" . -}} {{- partial "inject/body.html" . -}} diff --git a/layouts/_default/search.json b/layouts/_default/search.json index 5f04f46..f740da8 100644 --- a/layouts/_default/search.json +++ b/layouts/_default/search.json @@ -8,7 +8,7 @@ "title" .Title "date" (.Date.Format "2006-01-02") "tags" (sort (or .Params.tags slice)) - "summary" .Summary + "summary" (or .Params.description .Summary) "text" (lower .Plain) "link" .Permalink "image" (or .Params.Image "")) }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 2b60730..f20d5db 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,41 +1,3 @@ {{ define "main" }} - {{- partial "inject/content-before.html" . -}} -
-

{{ .Title }}

- {{ if (.Params.showDate | default true) }} -

- ï—¬ - {{- partial "date.html" .Date -}} -

- {{ end }} - {{ if .Params.Image }} - - {{ end }} - {{ if (.Params.toc | default false) }} -
- {{ .TableOfContents }} -
-
- {{ end }} -
{{ .Content }}
-
- {{ if .Params.tags }} - {{ if not .Site.Params.paperCards }}
{{ end }} -

-  - {{ i18n "tagsColumn" }} - {{ range sort .Params.tags }} - #{{ . }} - {{ end }} -

- {{ end }} - {{- partial "inject/content-after.html" . -}} - {{- partial "share_on_fediverse.html" . -}} - {{- partial "commento.html" . -}} - {{- partial "cactus_chat.html" . -}} - {{- partial "related_articles.html" . -}} + {{- partial "single_post.html" . -}} {{ end }} diff --git a/layouts/index.html b/layouts/index.html index c51291a..3a5701a 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -2,8 +2,14 @@ {{/* get all the pages that are regular posts and not pages */}} {{ $postsDir := .Site.Params.Posts | default (slice "posts" "post") }} - {{ $allPostsList := where site.RegularPages "Section" "in" $postsDir }} + {{ $allPostsList := where (where site.RegularPages "Section" "in" $postsDir) "Section" "!=" "" }} {{- partial "showcase.html" . -}} - {{- partial "home_post_list.html" (dict "Ctx" . "AllPostsList" $allPostsList) -}} + {{ if and .Site.Params.showSinglePageAsHome (ne .Site.Params.homeSinglePage "") }} + {{ with .Site.GetPage .Site.Params.homeSinglePage }} + {{- partial "single_post.html" . -}} + {{ end }} + {{ else }} + {{- partial "home_post_list.html" (dict "Ctx" . "AllPostsList" $allPostsList) -}} + {{ end }} {{ end }} diff --git a/layouts/index.json b/layouts/index.json index fa20404..4259ba0 100644 --- a/layouts/index.json +++ b/layouts/index.json @@ -15,7 +15,7 @@ "title" .Title "date" (.Date.Format "2006-01-02") "tags" (sort (or .Params.tags slice)) - "summary" .Summary + "summary" (or .Params.description .Summary) "link" .Permalink "image" (or .Params.Image "")) }} {{ end }} diff --git a/layouts/index.xml b/layouts/index.xml index 5f52ecc..155c39c 100644 --- a/layouts/index.xml +++ b/layouts/index.xml @@ -11,6 +11,7 @@ {{- $pages = $pages | first $limit -}} {{- end -}} {{- printf "" | safeHTML }} +{{- printf "" | safeHTML -}} {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} diff --git a/layouts/partials/article_card.html b/layouts/partials/article_card.html index e263f1f..6a8c7ad 100644 --- a/layouts/partials/article_card.html +++ b/layouts/partials/article_card.html @@ -23,7 +23,13 @@ {{end}} {{ if (site.Params.articleSummary | default true) }}
-

{{ .Summary }}

+

+ {{ if .Params.description }} + {{ .Params.description }} + {{ else }} + {{.Summary }} + {{ end }} +

{{ i18n "continueReading" }} ï•“

{{ end }} diff --git a/layouts/partials/build_assets.html b/layouts/partials/build_assets.html new file mode 100644 index 0000000..216434e --- /dev/null +++ b/layouts/partials/build_assets.html @@ -0,0 +1,10 @@ +{{/* + This partial builds non-standard assets (like xsl files) with the template + engine. It is necessary to do it this way to reduce user friction and + ensure that the file is there. +*/}} +{{ if .IsHome }} + {{ $feed_style_xsl_template := resources.Get "feed_style.xsl" }} + {{ $feed_style_xsl := $feed_style_xsl_template | resources.ExecuteAsTemplate "feed_style.xsl" . }} + {{ $noop := $feed_style_xsl.Permalink }} +{{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 6562654..ba5b281 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -29,9 +29,10 @@ {{ end }} {{ $style := resources.Get "/scss/style.scss" | resources.ExecuteAsTemplate "/scss/style.scss" . | resources.ToCSS (dict "targetPath" "css/styles.css" "outputStyle" "compressed" "enableSourceMap" "true") | resources.Fingerprint "sha512" }} - + {{- partial "inject/head.html" . -}} {{- partial "head_meta_seo.html" . -}} {{- partial "head_meta_opengraph.html" . -}} + {{- partial "head_meta_twitter.html" . -}} diff --git a/layouts/partials/head_meta_opengraph.html b/layouts/partials/head_meta_opengraph.html index a5c591a..890e48a 100644 --- a/layouts/partials/head_meta_opengraph.html +++ b/layouts/partials/head_meta_opengraph.html @@ -22,7 +22,7 @@ {{ if .Params.description }} {{ else }} - + {{ end }} {{ else }} + + + +{{ if .IsPage }} + + + + {{ if .Params.description }} + + {{ else }} + + {{ end }} +{{ else }} + + {{ if .Site.Params.description }} + + {{ end }} + +{{ end }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 9fa4514..2ef48b1 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -2,13 +2,18 @@ {{- partial "inject/header-before.html" . -}}
- - - + {{ if not (.Site.Params.logoRightOfTitle | default false) }} + + + + {{ end }}