diff options
author | vvveiii <cntrump@gmail.com> | 2020-01-02 02:27:21 +0300 |
---|---|---|
committer | vvveiii <cntrump@gmail.com> | 2020-01-02 02:27:21 +0300 |
commit | ba8b43e22897dbc9c150f63267fbe046df013f9b (patch) | |
tree | b52e132e45676be52909d82ea963b565069c9472 /README.md | |
parent | 45f64b3d1bdd9d14a612751b0df7646ff8154c4a (diff) |
using navigation-items.html partial rewrite header right side items.
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 28 |
1 files changed, 21 insertions, 7 deletions
@@ -262,22 +262,36 @@ On user-side: ### Custom header right items -Create an user-side partial: `header-right.html` +Create an user-side partial: `navigation-items.html` ``` . └── layouts └── partials - └── header-right.html + └── navigation-items.html ``` -An example header-right.html: +An example navigation-items.html: ```html -<a class="article-tag" href="{{- `/tags/ios/` | relURL -}}">iOS</a> -<a class="article-tag" href="{{- `/tags/swift/` | relURL -}}">Swift</a> -<a class="article-tag" href="{{- `/tags/` | relURL -}}">Tags</a> -<a class="article-tag" href="https://github.com/cntrump" target="_blank">Github</a> +{{- $nav := . -}} +{{- if or $nav.showCategories $nav.showTags $nav.custom -}} +<div class="nav-wrap"><div class="nav"> + {{- if $nav.showCategories -}} + <a class="nav-item" href="{{- `/categories/` | relURL -}}">Categories</a> + {{- end -}} + {{- if $nav.showTags -}} + <a class="nav-item" href="{{- `/tags/` | relURL -}}">Tags</a> + {{- end -}} + {{- range $nav.custom -}} + {{- $url := .url | safeURL -}} + {{- if strings.HasPrefix $url "/" -}}{{- $url = ($url | relURL) -}}{{- end -}} + <a class="nav-item" href="{{- $url -}}" + {{- if strings.HasPrefix $url "http" -}}target="_blank" + {{- end -}}>{{- .title -}}</a> + {{- end -}} +</div></div> +{{- end -}} ``` ![](https://raw.githubusercontent.com/cntrump/hugo-notepadium/master/images/04.png) |