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)
|
||||
- Multilingual mode
|
||||
- Robots.txt
|
||||
- Favorite posts
|
||||
|
||||
## Installation
|
||||
|
||||
@ -82,6 +83,9 @@ Check config/example usage in [exampleSiteMultilingual](https://github.com/Mitri
|
||||
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).
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -3,16 +3,14 @@
|
||||
{{ .Content }}
|
||||
</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 }}
|
||||
{{ range $pages }}
|
||||
<div class="post-short-list">
|
||||
<header>
|
||||
<h2>
|
||||
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||
</h2>
|
||||
<h2 class="post-title{{ if .Params.favorite }} favorite{{end}}"><a href="{{ .RelPermalink }}">{{ trim .Title " " }}</a></h2>
|
||||
</header>
|
||||
{{ partial "articleInfoFull.html" . }}
|
||||
{{ partial "postInfoFull.html" . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
|
@ -2,12 +2,12 @@
|
||||
|
||||
<article class="post">
|
||||
<header>
|
||||
<h1>{{ .Title }}</h1>
|
||||
<h1 class="post-title{{ if .Params.favorite }} favorite{{end}}">{{ trim .Title " " }}</h1>
|
||||
</header>
|
||||
<div class="content">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
{{ partial "articleInfoFull.html" . }}
|
||||
{{ partial "postInfoFull.html" . }}
|
||||
</article>
|
||||
{{ if .Site.DisqusShortname }}
|
||||
{{ template "_internal/disqus.html" . }}
|
||||
|
@ -5,24 +5,7 @@
|
||||
|
||||
{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
|
||||
{{ range (.Paginate $pages).Pages }}
|
||||
<article class="post-list">
|
||||
<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>
|
||||
{{ partial "postSummary.html" . }}
|
||||
{{ end }}
|
||||
{{ 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 }}
|
||||
{{ end }}
|
||||
|
||||
<div class="article-info">
|
||||
<div class="post-info">
|
||||
{{ if .Params.date }}
|
||||
<div class="article-date">{{ .Params.date.Format $dateFormat }}</div>
|
||||
<div class="post-date">{{ .Params.date.Format $dateFormat }}</div>
|
||||
{{ end }}
|
||||
<div class="article-taxonomies">
|
||||
<div class="post-taxonomies">
|
||||
{{ if .Params.categories }}
|
||||
<ul class="article-categories">
|
||||
<ul class="post-categories">
|
||||
{{ range .Params.categories }}
|
||||
<li><a href="{{ "categories/" | absLangURL }}{{ . }}">{{ . }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
{{ if .Params.tags }}
|
||||
<ul class="article-tags">
|
||||
<ul class="post-tags">
|
||||
{{ range .Params.tags }}
|
||||
<li><a href="{{ "tags/" | absLangURL }}{{ . | urlize }}">#{{ . }}</a></li>
|
||||
{{ 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" }}
|
||||
|
||||
<h1>{{ i18n "category" | humanize }}: {{ .Title }}</h1>
|
||||
<div class="article-info">
|
||||
<div class="post-info">
|
||||
<a href="{{ "categories/" | absLangURL }}">{{ i18n "toAllCategories" | humanize }}</a>
|
||||
</div>
|
||||
{{ range .Data.Pages }}
|
||||
<article class="post-list">
|
||||
<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>
|
||||
{{ partial "postSummary.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
@ -1,28 +1,11 @@
|
||||
{{ define "main" }}
|
||||
|
||||
<h1>{{ i18n "tag" | humanize }}: {{ .Title }}</h1>
|
||||
<div class="article-info">
|
||||
<div class="post-info">
|
||||
<a href="{{ "tags/" | absURL }}">{{ i18n "toAllTags" | humanize}}</a>
|
||||
</div>
|
||||
{{ range .Data.Pages }}
|
||||
<article class="post-list">
|
||||
<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>
|
||||
{{ partial "postSummary.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
@ -215,6 +215,12 @@ main h1 {
|
||||
|
||||
/* Articles */
|
||||
|
||||
.post-title.favorite::after {
|
||||
content: "★";
|
||||
display: inline-block;
|
||||
margin-left: 0.2em;
|
||||
}
|
||||
|
||||
|
||||
article:not(:last-of-type) {
|
||||
border-bottom: thin solid #f1f1f1;
|
||||
@ -234,52 +240,52 @@ article header h1 a {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.article-info {
|
||||
.post-info {
|
||||
font-size: 0.75em;
|
||||
color: grey;
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
.article-info a {
|
||||
.post-info a {
|
||||
color: grey;
|
||||
}
|
||||
|
||||
.article-info a:hover {
|
||||
.post-info a:hover {
|
||||
color: #a31d1d;
|
||||
}
|
||||
|
||||
.post-short-list .article-info {
|
||||
.post-short-list .post-info {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1.5em;
|
||||
}
|
||||
|
||||
.article-taxonomies {
|
||||
.post-taxonomies {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.article-date {
|
||||
.post-date {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.article-categories {
|
||||
.post-categories {
|
||||
display: inline;
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.article-categories li {
|
||||
.post-categories li {
|
||||
display: inline;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
.article-tags {
|
||||
.post-tags {
|
||||
display: inline;
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.article-tags li {
|
||||
.post-tags li {
|
||||
display: inline;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user