Add favorite posts. Close #19
This commit is contained in:
parent
518f134ac2
commit
82727c8e8a
@ -16,6 +16,7 @@ Anubis is a simple minimalist theme for [Hugo blog engine](https://gohugo.io/).
|
|||||||
- Translations (en, ru, fr, pl)
|
- Translations (en, ru, fr, pl)
|
||||||
- Multilingual mode
|
- Multilingual mode
|
||||||
- Robots.txt
|
- Robots.txt
|
||||||
|
- Favorite posts
|
||||||
|
|
||||||
## Installation
|
## 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/).
|
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
|
### Robots.txt
|
||||||
Based on environment.
|
Based on environment.
|
||||||
For production — allow all, for other — disallow all.
|
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
|
## 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).
|
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).
|
||||||
|
@ -14,6 +14,7 @@ categories = [
|
|||||||
"syntax",
|
"syntax",
|
||||||
]
|
]
|
||||||
aliases = ["migrate-from-jekyl"]
|
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.
|
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.
|
||||||
|
@ -14,6 +14,7 @@ categories = [
|
|||||||
"syntax",
|
"syntax",
|
||||||
]
|
]
|
||||||
aliases = ["migrate-from-jekyl"]
|
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.
|
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.
|
||||||
|
@ -14,6 +14,7 @@ categories = [
|
|||||||
"syntax",
|
"syntax",
|
||||||
]
|
]
|
||||||
aliases = ["migrate-from-jekyl"]
|
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.
|
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.
|
||||||
|
@ -3,16 +3,14 @@
|
|||||||
{{ .Content }}
|
{{ .Content }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1>{{ i18n .Title }}</h1>
|
<h1 class="post-title{{ if .Params.favorite }} favorite{{end}}">{{ i18n .Title }}</h1>
|
||||||
{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
|
{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
|
||||||
{{ range $pages }}
|
{{ range $pages }}
|
||||||
<div class="post-short-list">
|
<div class="post-short-list">
|
||||||
<header>
|
<header>
|
||||||
<h2>
|
<h2 class="post-title{{ if .Params.favorite }} favorite{{end}}"><a href="{{ .RelPermalink }}">{{ trim .Title " " }}</a></h2>
|
||||||
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
|
||||||
</h2>
|
|
||||||
</header>
|
</header>
|
||||||
{{ partial "articleInfoFull.html" . }}
|
{{ partial "postInfoFull.html" . }}
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
<article class="post">
|
<article class="post">
|
||||||
<header>
|
<header>
|
||||||
<h1>{{ .Title }}</h1>
|
<h1 class="post-title{{ if .Params.favorite }} favorite{{end}}">{{ trim .Title " " }}</h1>
|
||||||
</header>
|
</header>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{{ .Content }}
|
{{ .Content }}
|
||||||
</div>
|
</div>
|
||||||
{{ partial "articleInfoFull.html" . }}
|
{{ partial "postInfoFull.html" . }}
|
||||||
</article>
|
</article>
|
||||||
{{ if .Site.DisqusShortname }}
|
{{ if .Site.DisqusShortname }}
|
||||||
{{ template "_internal/disqus.html" . }}
|
{{ template "_internal/disqus.html" . }}
|
||||||
|
@ -5,24 +5,7 @@
|
|||||||
|
|
||||||
{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
|
{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
|
||||||
{{ range (.Paginate $pages).Pages }}
|
{{ range (.Paginate $pages).Pages }}
|
||||||
<article class="post-list">
|
{{ partial "postSummary.html" . }}
|
||||||
<header>
|
|
||||||
<h1>
|
|
||||||
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
|
||||||
</h1>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<div class="content post-summary">
|
|
||||||
{{ .Summary | safeHTML }}
|
|
||||||
</div>
|
|
||||||
<!-- {{ if .Truncated }}
|
|
||||||
<div class="read-more">
|
|
||||||
<a href="{{ .RelPermalink }}">{{ i18n "readMore" | humanize }}</a>
|
|
||||||
</div>
|
|
||||||
{{ end }} -->
|
|
||||||
|
|
||||||
{{ partial "articleInfoFull.html" . }}
|
|
||||||
</article>
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ partial "pagination.html" . }}
|
{{ partial "pagination.html" . }}
|
||||||
|
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
{{ $dateFormat := "2006-01-02" }}
|
|
||||||
{{ if .Site.Params.dateFormat }}
|
|
||||||
{{ $dateFormat = .Site.Params.dateFormat }}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
<div class="article-info">
|
|
||||||
{{ if .Params.date }}
|
|
||||||
<div class="article-date">{{ .Params.date.Format $dateFormat }}</div>
|
|
||||||
{{ end }}
|
|
||||||
</div>
|
|
@ -3,20 +3,20 @@
|
|||||||
{{ $dateFormat = .Site.Params.dateFormat }}
|
{{ $dateFormat = .Site.Params.dateFormat }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<div class="article-info">
|
<div class="post-info">
|
||||||
{{ if .Params.date }}
|
{{ if .Params.date }}
|
||||||
<div class="article-date">{{ .Params.date.Format $dateFormat }}</div>
|
<div class="post-date">{{ .Params.date.Format $dateFormat }}</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<div class="article-taxonomies">
|
<div class="post-taxonomies">
|
||||||
{{ if .Params.categories }}
|
{{ if .Params.categories }}
|
||||||
<ul class="article-categories">
|
<ul class="post-categories">
|
||||||
{{ range .Params.categories }}
|
{{ range .Params.categories }}
|
||||||
<li><a href="{{ "categories/" | absLangURL }}{{ . }}">{{ . }}</a></li>
|
<li><a href="{{ "categories/" | absLangURL }}{{ . }}">{{ . }}</a></li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if .Params.tags }}
|
{{ if .Params.tags }}
|
||||||
<ul class="article-tags">
|
<ul class="post-tags">
|
||||||
{{ range .Params.tags }}
|
{{ range .Params.tags }}
|
||||||
<li><a href="{{ "tags/" | absLangURL }}{{ . | urlize }}">#{{ . }}</a></li>
|
<li><a href="{{ "tags/" | absLangURL }}{{ . | urlize }}">#{{ . }}</a></li>
|
||||||
{{ end }}
|
{{ end }}
|
16
layouts/partials/postSummary.html
Normal file
16
layouts/partials/postSummary.html
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<article class="post-list">
|
||||||
|
<header>
|
||||||
|
<h1 class="post-title{{ if .Params.favorite }} favorite{{end}}"><a href="{{ .RelPermalink }}">{{ trim .Title " " }}</a></h1>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="content post-summary">
|
||||||
|
{{ .Summary | safeHTML }}
|
||||||
|
</div>
|
||||||
|
<!-- {{ if .Truncated }}
|
||||||
|
<div class="read-more">
|
||||||
|
<a href="{{ .RelPermalink }}">{{ i18n "readMore" | humanize }}</a>
|
||||||
|
</div>
|
||||||
|
{{ end }} -->
|
||||||
|
|
||||||
|
{{ partial "postInfoFull.html" . }}
|
||||||
|
</article>
|
@ -1,27 +1,11 @@
|
|||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
|
|
||||||
<h1>{{ i18n "category" | humanize }}: {{ .Title }}</h1>
|
<h1>{{ i18n "category" | humanize }}: {{ .Title }}</h1>
|
||||||
<div class="article-info">
|
<div class="post-info">
|
||||||
<a href="{{ "categories/" | absLangURL }}">{{ i18n "toAllCategories" | humanize }}</a>
|
<a href="{{ "categories/" | absLangURL }}">{{ i18n "toAllCategories" | humanize }}</a>
|
||||||
</div>
|
</div>
|
||||||
{{ range .Data.Pages }}
|
{{ range .Data.Pages }}
|
||||||
<article class="post-list">
|
{{ partial "postSummary.html" . }}
|
||||||
<header>
|
|
||||||
<h1>
|
|
||||||
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
|
||||||
</h1>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<div class="content post-summary">
|
|
||||||
{{ .Summary | safeHTML }}
|
|
||||||
</div>
|
|
||||||
{{ partial "articleInfoDate.html" . }}
|
|
||||||
<!-- {{ if .Truncated }}
|
|
||||||
<div class="read-more">
|
|
||||||
<a href="{{ .RelPermalink }}">{{ i18n "readMore" | humanize }}</a>
|
|
||||||
</div>
|
|
||||||
{{ end }} -->
|
|
||||||
</article>
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
@ -1,28 +1,11 @@
|
|||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
|
|
||||||
<h1>{{ i18n "tag" | humanize }}: {{ .Title }}</h1>
|
<h1>{{ i18n "tag" | humanize }}: {{ .Title }}</h1>
|
||||||
<div class="article-info">
|
<div class="post-info">
|
||||||
<a href="{{ "tags/" | absURL }}">{{ i18n "toAllTags" | humanize}}</a>
|
<a href="{{ "tags/" | absURL }}">{{ i18n "toAllTags" | humanize}}</a>
|
||||||
</div>
|
</div>
|
||||||
{{ range .Data.Pages }}
|
{{ range .Data.Pages }}
|
||||||
<article class="post-list">
|
{{ partial "postSummary.html" . }}
|
||||||
<header>
|
|
||||||
<h1>
|
|
||||||
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
|
||||||
</h1>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<div class="content post-summary">
|
|
||||||
{{ .Summary | safeHTML }}
|
|
||||||
</div>
|
|
||||||
{{ partial "articleInfoDate.html" . }}
|
|
||||||
<!-- {{ if .Truncated }}
|
|
||||||
<div class="read-more">
|
|
||||||
<a href="{{ .RelPermalink }}">{{ i18n "readMore" | humanize }}</a>
|
|
||||||
</div>
|
|
||||||
{{ end }} -->
|
|
||||||
|
|
||||||
</article>
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
@ -215,6 +215,12 @@ main h1 {
|
|||||||
|
|
||||||
/* Articles */
|
/* Articles */
|
||||||
|
|
||||||
|
.post-title.favorite::after {
|
||||||
|
content: "★";
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: 0.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
article:not(:last-of-type) {
|
article:not(:last-of-type) {
|
||||||
border-bottom: thin solid #f1f1f1;
|
border-bottom: thin solid #f1f1f1;
|
||||||
@ -234,52 +240,52 @@ article header h1 a {
|
|||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-info {
|
.post-info {
|
||||||
font-size: 0.75em;
|
font-size: 0.75em;
|
||||||
color: grey;
|
color: grey;
|
||||||
margin-top: 1em;
|
margin-top: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-info a {
|
.post-info a {
|
||||||
color: grey;
|
color: grey;
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-info a:hover {
|
.post-info a:hover {
|
||||||
color: #a31d1d;
|
color: #a31d1d;
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-short-list .article-info {
|
.post-short-list .post-info {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
margin-bottom: 1.5em;
|
margin-bottom: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-taxonomies {
|
.post-taxonomies {
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-date {
|
.post-date {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-categories {
|
.post-categories {
|
||||||
display: inline;
|
display: inline;
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-categories li {
|
.post-categories li {
|
||||||
display: inline;
|
display: inline;
|
||||||
margin-right: 1em;
|
margin-right: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-tags {
|
.post-tags {
|
||||||
display: inline;
|
display: inline;
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-tags li {
|
.post-tags li {
|
||||||
display: inline;
|
display: inline;
|
||||||
margin-right: 1em;
|
margin-right: 1em;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user