Skip to content

Commit 57c6b23

Browse files
committed
Partial: Refactored to be generic
1 parent f850e24 commit 57c6b23

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

layouts/partials/changelog-date.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
{{ $changelogContent := readFile "content/nginx-one/changelog.md" }}
22
{{ $maxNumLogs := 3 }}
33
{{ $headings := first $maxNumLogs (findRE `(?m)^##\s(.+)$` $changelogContent) }}
4+
{{ $productUrl := .Page.Permalink }}
5+
{{ $baseUrl := .Site.BaseURL }}
6+
{{ $linkSplit := split (replace $productUrl $baseUrl "") "/" }}
7+
{{ $productName := index $linkSplit 0 }}
48
<ul>
59
{{ range $headings }}
610
{{ $title := replaceRE "^##\\s" "" . }}
7-
<li><a href="{{ absURL "nginx-one/changelog/" }}#{{urlize $title}}">{{ $title }}</a></li>
11+
<li><a href="{{ absURL (print $productName "/changelog/#" (urlize $title)) }}">{{ $title }}</a></li>
812
{{ end }}
9-
<li><a href="{{ absURL "nginx-one/changelog/" }}">Older...</a></li>
13+
<li><a href="{{ absURL (print $productName "/changelog/")}}">Older...</a></li>
1014
</ul>

0 commit comments

Comments
 (0)