diff --git a/README.md b/README.md index 9c7d578..662c673 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Anubis is a simple minimalist theme for [Hugo blog engine](https://gohugo.io/). - Translations (en, ru, fr, pl) - Multilingual mode - Robots.txt +- Favorite posts ## Installation @@ -79,9 +80,12 @@ or just put `env: production` to `params` section of config. Check config/example usage in [exampleSiteMultilingual](https://github.com/Mitrichius/hugo-theme-anubis/tree/master/exampleSiteMultilingual) directory and documentation on [Hugo site](https://gohugo.io/content-management/multilingual/). ### Robots.txt -Based on environment. +Based on environment. For production — allow all, for other — disallow all. +### Favorite posts +To mark posts as favorite just add `favorite: true` in post's front matter. It adds a "★" icon nearby post's title. + ## Contributing If you find a bug or have an idea for a feature, feel free to write an [issue](https://github.com/mitrichius/hugo-theme-anubis/issues). diff --git a/exampleSite/content/post/markdown-syntax.md b/exampleSite/content/post/markdown-syntax.md index 5e1a786..2d8bcf1 100644 --- a/exampleSite/content/post/markdown-syntax.md +++ b/exampleSite/content/post/markdown-syntax.md @@ -14,6 +14,7 @@ categories = [ "syntax", ] aliases = ["migrate-from-jekyl"] +favorite = true +++ This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme. diff --git a/exampleSiteMultilingual/content/post/markdown-syntax.md b/exampleSiteMultilingual/content/post/markdown-syntax.md index 5e1a786..2d8bcf1 100644 --- a/exampleSiteMultilingual/content/post/markdown-syntax.md +++ b/exampleSiteMultilingual/content/post/markdown-syntax.md @@ -14,6 +14,7 @@ categories = [ "syntax", ] aliases = ["migrate-from-jekyl"] +favorite = true +++ This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme. diff --git a/exampleSiteMultilingual/content/post/markdown-syntax.pl.md b/exampleSiteMultilingual/content/post/markdown-syntax.pl.md index 5e1a786..2d8bcf1 100644 --- a/exampleSiteMultilingual/content/post/markdown-syntax.pl.md +++ b/exampleSiteMultilingual/content/post/markdown-syntax.pl.md @@ -14,6 +14,7 @@ categories = [ "syntax", ] aliases = ["migrate-from-jekyl"] +favorite = true +++ This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme. diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 32f9e8e..6d9d7e4 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -3,16 +3,14 @@ {{ .Content }} -

{{ i18n .Title }}

+

{{ i18n .Title }}

{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} {{ range $pages }}
-

- {{ .Title }} -

+

{{ trim .Title " " }}

- {{ partial "articleInfoFull.html" . }} + {{ partial "postInfoFull.html" . }}
{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 55c5a38..c53e9e3 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -2,12 +2,12 @@
-

{{ .Title }}

+

{{ trim .Title " " }}

{{ .Content }}
- {{ partial "articleInfoFull.html" . }} + {{ partial "postInfoFull.html" . }}
{{ if .Site.DisqusShortname }} {{ template "_internal/disqus.html" . }} diff --git a/layouts/index.html b/layouts/index.html index f22a121..eb0eaaa 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -5,24 +5,7 @@ {{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} {{ range (.Paginate $pages).Pages }} -
-
-

- {{ .Title }} -

-
- -
- {{ .Summary | safeHTML }} -
- - - {{ partial "articleInfoFull.html" . }} -
+ {{ partial "postSummary.html" . }} {{ end }} {{ partial "pagination.html" . }} diff --git a/layouts/partials/articleInfoDate.html b/layouts/partials/articleInfoDate.html deleted file mode 100644 index a428163..0000000 --- a/layouts/partials/articleInfoDate.html +++ /dev/null @@ -1,10 +0,0 @@ -{{ $dateFormat := "2006-01-02" }} -{{ if .Site.Params.dateFormat }} - {{ $dateFormat = .Site.Params.dateFormat }} -{{ end }} - -
- {{ if .Params.date }} -
{{ .Params.date.Format $dateFormat }}
- {{ end }} -
\ No newline at end of file diff --git a/layouts/partials/articleInfoFull.html b/layouts/partials/postInfoFull.html similarity index 74% rename from layouts/partials/articleInfoFull.html rename to layouts/partials/postInfoFull.html index da24bb4..a600126 100644 --- a/layouts/partials/articleInfoFull.html +++ b/layouts/partials/postInfoFull.html @@ -3,20 +3,20 @@ {{ $dateFormat = .Site.Params.dateFormat }} {{ end }} -
+
{{ if .Params.date }} - + {{ end }} -
+
{{ if .Params.categories }} -
    +
      {{ range .Params.categories }}
    • {{ . }}
    • {{ end }}
    {{ end }} {{ if .Params.tags }} -