diff --git a/README.md b/README.md index ecf3217..2af25be 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 @@ -249,6 +255,8 @@ Every post can have various parameters in the frontmatter, here are some that yo - `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/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 9229957..3a5701a 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -4,6 +4,12 @@ {{ $postsDir := .Site.Params.Posts | default (slice "posts" "post") }} {{ $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/partials/single_post.html b/layouts/partials/single_post.html new file mode 100644 index 0000000..0972df4 --- /dev/null +++ b/layouts/partials/single_post.html @@ -0,0 +1,43 @@ +{{- partial "inject/content-before.html" . -}} +
+ {{ if .Params.showTitle | default true }} +

{{ .Title }}

+ {{ end }} + {{ 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" . -}} +{{ if .Params.showShare | default true }} + {{- partial "share_on_fediverse.html" . -}} +{{ end }} +{{- partial "commento.html" . -}} +{{- partial "cactus_chat.html" . -}} +{{- partial "related_articles.html" . -}}