From f850e249daafc45ac2480c8aa67eb276b341d081 Mon Sep 17 00:00:00 2001 From: Lam Nguyen Date: Fri, 27 Jun 2025 09:30:40 -0700 Subject: [PATCH 1/3] Partial: Move changelog-date to theme from documentation --- layouts/partials/changelog-date.html | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 layouts/partials/changelog-date.html diff --git a/layouts/partials/changelog-date.html b/layouts/partials/changelog-date.html new file mode 100644 index 0000000..68c64d6 --- /dev/null +++ b/layouts/partials/changelog-date.html @@ -0,0 +1,10 @@ +{{ $changelogContent := readFile "content/nginx-one/changelog.md" }} +{{ $maxNumLogs := 3 }} +{{ $headings := first $maxNumLogs (findRE `(?m)^##\s(.+)$` $changelogContent) }} + \ No newline at end of file From f8664b23cf6b96122f184e62d5f3600defcc84f8 Mon Sep 17 00:00:00 2001 From: Lam Nguyen Date: Fri, 27 Jun 2025 11:11:32 -0700 Subject: [PATCH 2/3] Partial: Refactored to be generic --- layouts/partials/changelog-date.html | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/layouts/partials/changelog-date.html b/layouts/partials/changelog-date.html index 68c64d6..1d5d876 100644 --- a/layouts/partials/changelog-date.html +++ b/layouts/partials/changelog-date.html @@ -1,10 +1,15 @@ -{{ $changelogContent := readFile "content/nginx-one/changelog.md" }} +{{ $productUrl := .Page.Permalink }} +{{ $baseUrl := .Site.BaseURL }} +{{ $linkSplit := split (replace $productUrl $baseUrl "") "/" }} +{{ $productName := index $linkSplit 0 }} +{{ $changelogContent := readFile (printf "content/%s/changelog.md" $productName) }} {{ $maxNumLogs := 3 }} {{ $headings := first $maxNumLogs (findRE `(?m)^##\s(.+)$` $changelogContent) }} + \ No newline at end of file From af17fb90d24896db22d253d7f0310e7a636d8ecc Mon Sep 17 00:00:00 2001 From: Lam Nguyen Date: Mon, 30 Jun 2025 06:15:00 -0700 Subject: [PATCH 3/3] Partial: Added default text if no changelog --- layouts/partials/changelog-date.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/layouts/partials/changelog-date.html b/layouts/partials/changelog-date.html index 1d5d876..b239a72 100644 --- a/layouts/partials/changelog-date.html +++ b/layouts/partials/changelog-date.html @@ -1,15 +1,21 @@ + {{ $productUrl := .Page.Permalink }} {{ $baseUrl := .Site.BaseURL }} {{ $linkSplit := split (replace $productUrl $baseUrl "") "/" }} {{ $productName := index $linkSplit 0 }} + {{ $changelogContent := readFile (printf "content/%s/changelog.md" $productName) }} {{ $maxNumLogs := 3 }} {{ $headings := first $maxNumLogs (findRE `(?m)^##\s(.+)$` $changelogContent) }}
    + {{ if gt (len $headings) 0 }} {{ range $headings }} {{ $title := replaceRE "^##\\s" "" . }}
  • {{ $title }}
  • {{ end }}
  • Older...
  • + {{ else }} +
  • No changelog found...

  • + {{ end }}
\ No newline at end of file