Skip to content

Commit af17fb9

Browse files
committed
Partial: Added default text if no changelog
1 parent f8664b2 commit af17fb9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1+
<!-- Get the product name -->
12
{{ $productUrl := .Page.Permalink }}
23
{{ $baseUrl := .Site.BaseURL }}
34
{{ $linkSplit := split (replace $productUrl $baseUrl "") "/" }}
45
{{ $productName := index $linkSplit 0 }}
6+
<!-- Get the content -->
57
{{ $changelogContent := readFile (printf "content/%s/changelog.md" $productName) }}
68
{{ $maxNumLogs := 3 }}
79
{{ $headings := first $maxNumLogs (findRE `(?m)^##\s(.+)$` $changelogContent) }}
810

911
<ul>
12+
{{ if gt (len $headings) 0 }}
1013
{{ range $headings }}
1114
{{ $title := replaceRE "^##\\s" "" . }}
1215
<li><a href="{{ absURL (print $productName "/changelog/#" (urlize $title)) }}">{{ $title }}</a></li>
1316
{{ end }}
1417
<li><a href="{{ absURL (print $productName "/changelog/")}}">Older...</a></li>
18+
{{ else }}
19+
<li><p>No changelog found...</p></li>
20+
{{ end }}
1521
</ul>

0 commit comments

Comments
 (0)