summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md12
-rw-r--r--assets/sass/_customize.scss136
-rw-r--r--i18n/en.toml3
-rw-r--r--i18n/ru.toml3
-rw-r--r--layouts/_default/list.html (renamed from layouts/_default/list.html.html)1
-rw-r--r--layouts/_default/single.html4
-rw-r--r--layouts/_default/term.html26
-rw-r--r--layouts/partials/post-meta/date.html21
-rw-r--r--layouts/partials/post-tags.html9
-rw-r--r--layouts/partials/title.html2
-rw-r--r--resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content117
11 files changed, 319 insertions, 15 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9e491a3..2c9da82 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,13 +9,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
-- Provide ability to include custom scripts in the theme.
-- Provide ability to specify custom language of a post.
+- Provide ability to include custom scripts in the theme
+- Provide ability to specify custom language of a post
+- Add tagging support
### Changed
-- Mior reformatting of posts layout.
-- Allow to manually override lastmod date of a post.
+- Minor reformatting of posts layout
+- Allow manually override lastmod date of a post
+- Check that `lastmod` exists and is greater than `date` before printing it
## [v0.2.0](https://github.com/sergeyklay/gohugo-theme-ed/compare/v0.1.0...v0.2.0)
@@ -43,7 +45,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix margin bottom on the nested unordered lists for page's table of contents
- Fix default section type for the `params.mainSections` configuration variable
-- Fix url to sitemap in robots.txt file
+- Fix url to sitemap in `robots.txt` file
## v0.1.0 - 2022-05-27
diff --git a/assets/sass/_customize.scss b/assets/sass/_customize.scss
index 79d3aae..5eb978a 100644
--- a/assets/sass/_customize.scss
+++ b/assets/sass/_customize.scss
@@ -139,3 +139,139 @@ ul.pager li {
margin-bottom: 1rem;
display: inline-block;
}
+
+.post-tags-wrapper {
+ position: relative;
+}
+
+.post-tags {
+ margin: 0;
+ padding: 0;
+ position: absolute;
+ right: 24px;
+ bottom: -12px;
+ list-style: none;
+}
+
+.post-tags li,
+.post-tags a {
+ font-family: $heading-font;
+ float: left;
+ height: 24px;
+ line-height: 24px;
+ position: relative;
+ font-size: .75em;
+}
+
+.post-tags a {
+ margin-left: 20px;
+ padding: 0 10px 0 12px;
+ background: $link-color;
+ color: #fff;
+ text-decoration: none;
+ -webkit-border-bottom-right-radius:4px;
+ -moz-border-radius-bottomright:4px;
+ border-bottom-right-radius:4px;
+ -webkit-border-top-right-radius:4px;
+ -moz-border-radius-topright:4px;
+ border-top-right-radius:4px;
+}
+
+.post-tags a:before {
+ content: "";
+ float: left;
+ position: absolute;
+ top: 0;
+ left: -12px;
+ width: 0;
+ height: 0;
+ border-color: transparent $link-color transparent transparent;
+ border-style: solid;
+ border-width: 12px 12px 12px 0;
+}
+
+.post-tags a:after {
+ content: "";
+ position: absolute;
+ top: 10px;
+ left: 0;
+ float: left;
+ width: 4px;
+ height: 4px;
+ background: #fff;
+ @include border-radius (2px);
+ @include box-shadow (-1px -1px 2px $text-color);
+}
+
+.post-tags a:hover {
+ background: $text-light-color;
+}
+
+.post-tags a:hover:before {
+ border-color: transparent $text-light-color transparent transparent;
+}
+
+/* Themes */
+
+/* Red */
+.theme-base-red .post-tags a {
+ background: #ac4142;
+}
+
+.theme-base-red .post-tags a:before {
+ border-color: transparent #ac4142 transparent transparent;
+}
+
+/* Orange */
+.theme-base-orange .post-tags a {
+ background: #d28445;
+}
+
+.theme-base-orange .post-tags a:before {
+ border-color: transparent #d28445 transparent transparent;
+}
+
+/* Green */
+.theme-base-green .post-tags a {
+ background: #90a959;
+}
+
+.theme-base-green .post-tags a:before {
+ border-color: transparent #90a959 transparent transparent;
+}
+
+/* Cyan */
+.theme-base-cyan .post-tags a {
+ background: #75b5aa;
+}
+
+.theme-base-cyan .post-tags a:before {
+ border-color: transparent #75b5aa transparent transparent;
+}
+
+/* Blue */
+.theme-base-blue .post-tags a {
+ background: #6a9fb5;
+}
+
+.theme-base-blue .post-tags a:before {
+ border-color: transparent #6a9fb5 transparent transparent;
+}
+
+/* Magenta */
+.theme-base-magenta .post-tags a {
+ background: #aa759f;
+}
+
+.theme-base-magenta .post-tags a:before {
+ border-color: transparent #aa759f transparent transparent;
+}
+
+/* Brown */
+.theme-base-brown .post-tags a {
+ background: #8f5536;
+}
+
+.theme-base-brown .post-tags a:before {
+ border-color: transparent #8f5536 transparent transparent;
+}
diff --git a/i18n/en.toml b/i18n/en.toml
index bc92d51..82cd7fa 100644
--- a/i18n/en.toml
+++ b/i18n/en.toml
@@ -42,3 +42,6 @@
[all_publications]
other = 'All publications'
+
+[publications_tagged]
+ other = 'Publications tagged "{{ . }}"'
diff --git a/i18n/ru.toml b/i18n/ru.toml
index 2598df1..10c815a 100644
--- a/i18n/ru.toml
+++ b/i18n/ru.toml
@@ -42,3 +42,6 @@
[all_publications]
other = 'Все публикации'
+
+[publications_tagged]
+ other = 'Публикации с тегом "{{ . }}"'
diff --git a/layouts/_default/list.html.html b/layouts/_default/list.html
index fc39714..0dd32b6 100644
--- a/layouts/_default/list.html.html
+++ b/layouts/_default/list.html
@@ -1,7 +1,6 @@
{{ define "main" }}
<div class="articles">
- {{/* Render category name if any */}}
{{ with .Title }}<h1 class="page-title">{{ . }}</h1>{{ end }}
{{/* Render category content if any */}}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 6b2c851..56557e5 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -13,5 +13,9 @@
<div class="post-body">
{{ .Content }}
</div>
+
+ <div class="post-tags-wrapper">
+ {{ partial "post-tags.html" . }}
+ </div>
</article>
{{ end }}
diff --git a/layouts/_default/term.html b/layouts/_default/term.html
new file mode 100644
index 0000000..6ad5d40
--- /dev/null
+++ b/layouts/_default/term.html
@@ -0,0 +1,26 @@
+{{ define "main" }}
+
+<div class="articles">
+ {{/* TODO: Translate me */}}
+ <h1 class="page-title">
+ {{ with .Title }}{{ i18n "publications_tagged" . }}{{ end }}
+ </h1>
+
+ {{/* Render category content if any */}}
+ {{ with .Content }}
+ <div class="section-content">
+ {{ .Content }}
+ </div>
+ {{ end }}
+
+ {{/* Render posts list */}}
+ <div class="post-list">
+ {{ range .Paginator.Pages }}
+ {{ .Render "teaser" }}
+ {{ end }}
+
+ {{- partial "pagination.html" . -}}
+ </div>
+</div>
+
+{{ end }}
diff --git a/layouts/partials/post-meta/date.html b/layouts/partials/post-meta/date.html
index 04a814a..e5626cf 100644
--- a/layouts/partials/post-meta/date.html
+++ b/layouts/partials/post-meta/date.html
@@ -1,11 +1,14 @@
-{{ if not .Date.IsZero }}
- <time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">
- {{ .Date | time.Format (site.Params.dateformat | default "January 02, 2006") }}
- </time>
+{{ $date := .Date | time.Format (site.Params.dateformat | default "January 02, 2006") }}
+{{ $lastmod := .Lastmod | time.Format (site.Params.dateformat | default "January 02, 2006") }}
+
+<time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">
+ {{ $date }}
+</time>
- {{ if ne .Date .Lastmod }}
- <time datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">
- ({{ i18n "updated_at" }} {{ .Lastmod | time.Format (site.Params.dateformat | default "January 02, 2006") }})
- </time>
- {{ end }}
+{{/* Check that lastmod exists and is greater than date
+ (i.e. the last modified date must be after the publish date) */}}
+{{ if and (ne $lastmod $date) (gt .Lastmod .Date) }}
+ <time datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">
+ ({{ i18n "updated_at" }} {{ $lastmod }})
+ </time>
{{ end }}
diff --git a/layouts/partials/post-tags.html b/layouts/partials/post-tags.html
new file mode 100644
index 0000000..1fa1c96
--- /dev/null
+++ b/layouts/partials/post-tags.html
@@ -0,0 +1,9 @@
+{{ $tags := .Params.Tags | default slice }}
+
+<ul class="post-tags">
+ {{ range $index, $name := sort $tags -}}
+ <a href="{{ (printf "/tags/%s/" $name) | urlize }}">
+ {{ $name | markdownify }}
+ </a>
+ {{ end }}
+</ul>
diff --git a/layouts/partials/title.html b/layouts/partials/title.html
index 76cfb2f..b3754ba 100644
--- a/layouts/partials/title.html
+++ b/layouts/partials/title.html
@@ -1,5 +1,7 @@
{{- if or .IsHome (eq .Title site.Title) -}}
{{- site.Title -}}
+{{- else if and (eq .Kind "term") (eq .Data.Singular "tag") -}}
+ {{- with .Title }}{{ i18n "publications_tagged" . }} - {{ end }}{{ site.Title -}}
{{- else -}}
{{- with .Title }}{{ . }} - {{ end }}{{ site.Title -}}
{{- end -}}
diff --git a/resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content b/resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content
index 30e82bc..856b58b 100644
--- a/resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content
+++ b/resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content
@@ -970,3 +970,120 @@ ul.pager li {
.footnotes blockquote + a.footnote-backref {
margin-bottom: 1rem;
display: inline-block; }
+
+.post-tags-wrapper {
+ position: relative; }
+
+.post-tags {
+ margin: 0;
+ padding: 0;
+ position: absolute;
+ right: 24px;
+ bottom: -12px;
+ list-style: none; }
+
+.post-tags li,
+.post-tags a {
+ font-family: sans-serif;
+ float: left;
+ height: 24px;
+ line-height: 24px;
+ position: relative;
+ font-size: .75em; }
+
+.post-tags a {
+ margin-left: 20px;
+ padding: 0 10px 0 12px;
+ background: #841212;
+ color: #fff;
+ text-decoration: none;
+ -webkit-border-bottom-right-radius: 4px;
+ -moz-border-radius-bottomright: 4px;
+ border-bottom-right-radius: 4px;
+ -webkit-border-top-right-radius: 4px;
+ -moz-border-radius-topright: 4px;
+ border-top-right-radius: 4px; }
+
+.post-tags a:before {
+ content: "";
+ float: left;
+ position: absolute;
+ top: 0;
+ left: -12px;
+ width: 0;
+ height: 0;
+ border-color: transparent #841212 transparent transparent;
+ border-style: solid;
+ border-width: 12px 12px 12px 0; }
+
+.post-tags a:after {
+ content: "";
+ position: absolute;
+ top: 10px;
+ left: 0;
+ float: left;
+ width: 4px;
+ height: 4px;
+ background: #fff;
+ -webkit-border-radius: 2px;
+ -moz-border-radius: 2px;
+ border-radius: 2px;
+ -webkit-box-shadow: -1px -1px 2px #454545;
+ -moz-box-shadow: -1px -1px 2px #454545;
+ box-shadow: -1px -1px 2px #454545; }
+
+.post-tags a:hover {
+ background: #676767; }
+
+.post-tags a:hover:before {
+ border-color: transparent #676767 transparent transparent; }
+
+/* Themes */
+/* Red */
+.theme-base-red .post-tags a {
+ background: #ac4142; }
+
+.theme-base-red .post-tags a:before {
+ border-color: transparent #ac4142 transparent transparent; }
+
+/* Orange */
+.theme-base-orange .post-tags a {
+ background: #d28445; }
+
+.theme-base-orange .post-tags a:before {
+ border-color: transparent #d28445 transparent transparent; }
+
+/* Green */
+.theme-base-green .post-tags a {
+ background: #90a959; }
+
+.theme-base-green .post-tags a:before {
+ border-color: transparent #90a959 transparent transparent; }
+
+/* Cyan */
+.theme-base-cyan .post-tags a {
+ background: #75b5aa; }
+
+.theme-base-cyan .post-tags a:before {
+ border-color: transparent #75b5aa transparent transparent; }
+
+/* Blue */
+.theme-base-blue .post-tags a {
+ background: #6a9fb5; }
+
+.theme-base-blue .post-tags a:before {
+ border-color: transparent #6a9fb5 transparent transparent; }
+
+/* Magenta */
+.theme-base-magenta .post-tags a {
+ background: #aa759f; }
+
+.theme-base-magenta .post-tags a:before {
+ border-color: transparent #aa759f transparent transparent; }
+
+/* Brown */
+.theme-base-brown .post-tags a {
+ background: #8f5536; }
+
+.theme-base-brown .post-tags a:before {
+ border-color: transparent #8f5536 transparent transparent; }