summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md3
-rw-r--r--exampleSite/config.toml16
-rw-r--r--layouts/partials/sidebar.html41
3 files changed, 46 insertions, 14 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0e8f276..b2990ef 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,9 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add multilanguage support
- Add Russian translation
-- Provide an ability to use hreflang attribute in raw links
+- Provide an ability to use hreflang attribute in `link` shortcode
- Add `{{< mini-toc >}}` shortcode
- Provide an ability to use `keywords` meta tag
+- Provide ability to render feeds menu
### Changed
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index b19be14..64401db 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -221,6 +221,22 @@ disableKinds = ['RSS']
[menu.main.params]
external = true
+ [[menu.feeds]]
+ identifier = 'rss'
+ name = 'RSS 2.0'
+ url = '/feeds/feed.rss.xml'
+ weight = 1
+ [[menu.feeds]]
+ identifier = 'atom'
+ name = 'Atom'
+ url = '/feeds/feed.atom.xml'
+ weight = 2
+ [[menu.feeds]]
+ identifier = 'json'
+ name = 'Json Feed'
+ url = '/feeds/feed.json'
+ weight = 3
+
# For more see https://gohugo.io/getting-started/configuration-markup/
[markup]
defaultMarkdownHandler = 'goldmark'
diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html
index e6e4bd3..e3da92d 100644
--- a/layouts/partials/sidebar.html
+++ b/layouts/partials/sidebar.html
@@ -1,24 +1,39 @@
-{{/* Target for toggling the sidebar `.sidebar-checkbox` is for regular styles, `#sidebar-checkbox` for behavior. */}}
+{{/* Target for toggling the sidebar `.sidebar-checkbox` is for regular styles,
+ `#sidebar-checkbox` for behavior. */}}
<input type="checkbox" class="sidebar-checkbox" id="sidebar-checkbox">
-<!-- Toggleable sidebar -->
+{{/* Toggleable sidebar */}}
<aside class="sidebar" id="sidebar">
<div class="sidebar-item">
- <p>{{- site.Params.Description -}}</p>
+ <p>{{ site.Params.Description }}</p>
</div>
<nav class="sidebar-nav">
- {{- $current := . }}
- {{- range site.Menus.main }}
- {{- $active := or ($current.IsMenuCurrent "main" .) ($current.HasMenuCurrent "main" .) }}
- {{- $active = or $active (eq .URL $current.RelPermalink) }}
- {{- $active = or $active (eq .Name $current.Title) }}
- <a class="sidebar-nav-item{{ if $active }} active{{ end }}" href="{{ .URL }}" {{- if eq .Params.external true }} target="_blank" rel="noopener noreferrer"{{ end }}>
- {{- $text := print .Name | safeHTML -}}
- {{- $text -}}
- </a>
- {{- end -}}
+ {{ $current := . }}
+ {{ range site.Menus.main }}
+ {{ $active := or ($current.IsMenuCurrent "main" .) ($current.HasMenuCurrent "main" .) }}
+ {{ $active = or $active (eq .URL $current.RelPermalink) }}
+ {{ $active = or $active (eq .Name $current.Title) }}
+ <a class="sidebar-nav-item{{ if $active }} active{{ end }}"
+ href="{{ .URL }}"
+ id="menu-main-{{ .Identifier }}"
+ {{- if eq .Params.external true }} target="_blank" rel="noopener noreferrer"{{ end }}>
+ {{- print .Name | safeHTML -}}
+ </a>
+ {{ end }}
+
{{/* TODO: Add hypothesis support */}}
+
+ {{ with site.Menus.feeds }}
+ <div class="sidebar-nav-item">
+ {{ range $i, $ := site.Menus.feeds }}
+ {{ if $i }}<span aria-hidden="true">|</span>{{ end }}
+ <a href="{{ .URL }}" id="menu-feeds-{{ .Identifier }}">
+ {{ print .Name | safeHTML }}
+ </a>
+ {{ end }}
+ </div>
+ {{ end }}
</nav>
{{ partial "footer" . }}