Skip to content

Commit

Permalink
Allow pageRef with outputFormat for internal links
Browse files Browse the repository at this point in the history
  • Loading branch information
ldeso committed Dec 30, 2023
1 parent 725dd09 commit 0b8cacc
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,10 @@ menu:
pageRef: /categories
weight: 4
- name: RSS
url: /index.xml
pageRef: /
weight: 5
params:
- format: rss

mediaTypes:
font/woff2:
Expand Down
6 changes: 5 additions & 1 deletion assets/xml/base.tpl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@
</h1>
</li>
{{ range site.Menus.main }}
{{ $url := absLangURL .URL }}
{{ if isset .Params "format" | and .Page }}
{{ $url = (.Page.OutputFormats.Get .Params.format).Permalink }}
{{ end }}
<li class="Banner-item">
<a class="Banner-link u-clickable" href="{{ absLangURL .URL }}">{{ .Name }}</a>
<a class="Banner-link u-clickable" href="{{ $url }}">{{ .Name }}</a>
</li>
{{ end }}
</ul>
Expand Down
4 changes: 3 additions & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ menu:
pageRef: /categories
weight: 4
- name: RSS
url: /index.xml
pageRef: /
weight: 5
params:
- format: rss

mediaTypes:
font/woff2:
Expand Down
6 changes: 5 additions & 1 deletion layouts/partials/banner.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ <h1 class="Banner-heading">
</h1>
</li>
{{ range site.Menus.main }}
{{ $url := relLangURL .URL }}
{{ if isset .Params "format" | and .Page }}
{{ $url = (.Page.OutputFormats.Get .Params.format).RelPermalink }}
{{ end }}
<li class="Banner-item">
<a class="Banner-link u-clickable" href="{{ relLangURL .URL }}">{{ .Name }}</a>
<a class="Banner-link u-clickable" href="{{ $url }}">{{ .Name }}</a>
</li>
{{ end }}
</ul>
Expand Down

0 comments on commit 0b8cacc

Please sign in to comment.