diff --git a/.github/workflows/checklink.yml b/.github/workflows/checklink.yml
index 2cc329b30..d95853621 100644
--- a/.github/workflows/checklink.yml
+++ b/.github/workflows/checklink.yml
@@ -18,6 +18,10 @@ jobs:
uses: actions/checkout@v3
with:
submodules: recursive
+ - name: Update Latest URL content
+ shell: pwsh
+ run: |
+ .\createLatest.ps1
- name: npm install
working-directory: ./
run: |
@@ -40,9 +44,9 @@ jobs:
config: .htmltest.yml
- name: Archive htmltest results
if: always()
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
# Note: Set ACTIONS_RUNTIME_TOKEN env variable to test with nektos/act
with:
name: htmltest-report
path: tmp/.htmltest/htmltest.log
- retention-days: 7 # Default is 90 days
\ No newline at end of file
+ retention-days: 7 # Default is 90 days
diff --git a/.github/workflows/hugo.yml b/.github/workflows/hugo.yml
index 84f93fb0c..5bf20e681 100644
--- a/.github/workflows/hugo.yml
+++ b/.github/workflows/hugo.yml
@@ -43,6 +43,10 @@ jobs:
uses: actions/checkout@v3
with:
submodules: recursive
+ - name: Update Latest URL content
+ shell: pwsh
+ run: |
+ .\createLatest.ps1
- name: npm install
working-directory: ./
run: |
diff --git a/.gitignore b/.gitignore
index 512c80e8c..0ac1b8495 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,8 @@ public/
resources/
node_modules/
tech-doc-hugo
+content/en/docs/latest/
+content/static/latest/
content/static/**/*.dtmp
content/static/**/*.bkp
content/static/**/*.crswap
\ No newline at end of file
diff --git a/.htmltest.yml b/.htmltest.yml
index 5e76aaaa3..a2b7fbbd8 100644
--- a/.htmltest.yml
+++ b/.htmltest.yml
@@ -25,7 +25,8 @@ IgnoreURLs:
- "https://blogs.oracle.com/.*"
- "https://jsonformatter.org/.*"
- "https://www.newtonsoft.com/.*"
-- "https://.*/gov.uk/.*"
+- "https://.*.gov.uk/.*"
+
IgnoreDirs:
- "docs/?.*/_print/"
- "docs/?.*/_shared/"
diff --git a/createLatest.ps1 b/createLatest.ps1
new file mode 100644
index 000000000..f075f68db
--- /dev/null
+++ b/createLatest.ps1
@@ -0,0 +1,27 @@
+$Path = ".\config\_default\config.toml"
+$latestName = "latest"
+
+$LatestVersion = (Select-String -Path $Path -Pattern "latest = true" -Context 3, 0) -split "`""
+
+# Use $LatestVersion[1] as we know that the version is the first line returned and splitting on " makes it the 2nd index
+$Version = $LatestVersion[1]
+
+# Remove latest folder and contents in docs if it already exists
+if (Test-Path ".\content\en\docs\$latestName"){
+ Remove-Item -LiteralPath ".\content\en\docs\$latestName" -Force -Recurse
+}
+# Create new latest docs folder
+New-Item -ItemType Directory -Path ".\content\en\docs\$latestName\" -Force
+# Copy contents of latest XXXX.X version into latest folder
+Copy-Item -Path ".\content\en\docs\$Version\*" -Destination ".\content\en\docs\$latestName\" -Recurse -Force
+# Replace the title name for the folder to be latest
+(Get-Content .\content\en\docs\latest\_index.md) -replace $Version, "Latest" | Set-Content .\content\en\docs\latest\_index.md
+
+# Remove latest folder and contents in static if it already exists
+if (Test-Path ".\content\static\$latestName"){
+ Remove-Item -LiteralPath ".\content\static\$latestName" -Force -Recurse
+}
+# Create new latest static folder
+New-Item -ItemType Directory -Path ".\content\static\$latestName\" -Force
+# Copy contents of latest XXXX.X version into latest folder
+Copy-Item -Path ".\content\static\$Version\*" -Destination ".\content\static\$latestName\" -Recurse -Force
diff --git a/layouts/partials/navbar-version-selector.html b/layouts/partials/navbar-version-selector.html
index a7a24fb6e..720c43969 100644
--- a/layouts/partials/navbar-version-selector.html
+++ b/layouts/partials/navbar-version-selector.html
@@ -5,9 +5,9 @@
{{- $isRoot := false }}
{{- /* Get the current version, and whether the website is currently nested (has /docs prepended). */}}
{{- $isNested := false }}
-{{- $currentVer := index (findRE `^\/docs\/[0-9\.]*\/` .Page.RelPermalink 1) 0 }}
+{{- $currentVer := index (findRE `^\/docs\/([0-9\.]*|latest)\/` .Page.RelPermalink 1) 0 }}
{{- if (not $currentVer) }}
- {{- $currentVer = index (findRE `^\/docs\/docs\/[0-9\.]*\/` .Page.RelPermalink 1) 0 }}
+ {{- $currentVer = index (findRE `^\/docs\/docs\/([0-9\.]*|latest)\/` .Page.RelPermalink 1) 0 }}
{{- $currentVer = replaceRE `^\/docs` "" $currentVer 1 }}
{{- if (or $currentVer (index (findRE `^\/docs\/[^\/]*\/` .Page.RelPermalink 1) 0))}}
{{- $isNested = true }}
diff --git a/layouts/partials/section-index.html b/layouts/partials/section-index.html
new file mode 100644
index 000000000..b4d973a96
--- /dev/null
+++ b/layouts/partials/section-index.html
@@ -0,0 +1,31 @@
+
+ {{ $pages := (where .Site.Pages "Section" .Section).ByWeight }}
+ {{ $pages = (where $pages "Type" "!=" "search") }}
+ {{ $pages = (where $pages "Title" "!=" "Latest") }}
+ {{ $parent := .Page }}
+ {{ if $parent.Params.no_list }}
+ {{/* If no_list is true we don't show a list of subpages */}}
+ {{ else if $parent.Params.simple_list }}
+ {{/* If simple_list is true we show a bulleted list of subpages */}}
+
+ {{ range $pages }}
+ {{ if eq .Parent $parent }}
+ - {{- .Title -}}
+ {{ end }}
+ {{ end }}
+
+ {{ else }}
+ {{/* Otherwise we show a nice formatted list of subpages with page descriptions */}}
+
+ {{ range $pages }}
+ {{ if eq .Parent $parent }}
+
+
+
{{ .Description | markdownify }}
+
+ {{ end }}
+ {{ end }}
+ {{ end }}
+
diff --git a/layouts/shortcodes/ahref.html b/layouts/shortcodes/ahref.html
index cddf0963d..ddaf1b8c5 100644
--- a/layouts/shortcodes/ahref.html
+++ b/layouts/shortcodes/ahref.html
@@ -6,9 +6,9 @@
{{- $link := (printf "%s://%s%s" $url.Scheme $url.Host $url.Path) }}
{{- /* Get the current version, and whether the website is currently nested (has /docs prepended). */}}
{{- $isNested := false }}
-{{- $currentVer := index (findRE `^\/docs\/[0-9\.]*\/` .Page.RelPermalink 1) 0 }}
+{{- $currentVer := index (findRE `^\/docs\/([0-9\.]*|latest)\/` .Page.RelPermalink 1) 0 }}
{{- if (not $currentVer) }}
- {{- $currentVer = index (findRE `^\/docs\/docs\/[0-9\.]*\/` .Page.RelPermalink 1) 0 }}
+ {{- $currentVer = index (findRE `^\/docs\/docs\/([0-9\.]*|latest)\/` .Page.RelPermalink 1) 0 }}
{{- $currentVer = replaceRE `^\/docs` "" $currentVer 1 }}
{{- if (or $currentVer (index (findRE `^\/docs\/[^\/]*\/` .Page.RelPermalink 1) 0)) }}
{{- $isNested = true }}
diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html
index 4d1f96edd..ccdcf6de0 100644
--- a/layouts/shortcodes/figure.html
+++ b/layouts/shortcodes/figure.html
@@ -4,9 +4,9 @@
{{- $versionPath := "" }}
{{- /* Get the current version, and whether the website is currently nested (has /docs prepended). */}}
{{- $isNested := false }}
-{{- $currentVer := index (findRE `^\/docs\/[0-9\.]*\/` .Page.RelPermalink 1) 0 }}
+{{- $currentVer := index (findRE `^\/docs\/([0-9\.]*|latest)\/` .Page.RelPermalink 1) 0 }}
{{- if (not $currentVer) }}
- {{- $currentVer = index (findRE `^\/docs\/docs\/[0-9\.]*\/` .Page.RelPermalink 1) 0 }}
+ {{- $currentVer = index (findRE `^\/docs\/docs\/([0-9\.]*|latest)\/` .Page.RelPermalink 1) 0 }}
{{- $currentVer = replaceRE `^\/docs` "" $currentVer 1 }}
{{- if (or $currentVer (index (findRE `^\/docs\/[^\/]*\/` .Page.RelPermalink 1) 0)) }}
{{- $isNested = true }}
@@ -18,12 +18,14 @@
{{ range where .Site.Params.versions "url" $version }}
{{ $versionPath = .version }}
{{ end }}
+{{- else if eq $currentVer "/docs/latest/" }}
+ {{ $versionPath = "latest" }}
{{- else if $currentVer }}
{{ range where .Site.Params.versions "url" $currentVer }}
{{ $versionPath = .version }}
{{ end }}
{{- else }}
- {{- /* use latest as not in a versioned page */}}
+{{- /* use latest as not in a versioned page */}}
{{ range where .Site.Params.versions "latest" true }}
{{- $versionPath = .version }}
{{ end }}
diff --git a/layouts/shortcodes/filelink.html b/layouts/shortcodes/filelink.html
index 1d2cfe6bf..44dd03a3e 100644
--- a/layouts/shortcodes/filelink.html
+++ b/layouts/shortcodes/filelink.html
@@ -4,9 +4,9 @@
{{- $versionPath := "" }}
{{- /* Get the current version, and whether the website is currently nested (has /docs prepended). */}}
{{- $isNested := false }}
-{{- $currentVer := index (findRE `^\/docs\/[0-9\.]*\/` .Page.RelPermalink 1) 0 }}
+{{- $currentVer := index (findRE `^\/docs\/([0-9\.]*|latest)\/` .Page.RelPermalink 1) 0 }}
{{- if (not $currentVer) }}
- {{- $currentVer = index (findRE `^\/docs\/docs\/[0-9\.]*\/` .Page.RelPermalink 1) 0 }}
+ {{- $currentVer = index (findRE `^\/docs\/docs\/([0-9\.]*|latest)\/` .Page.RelPermalink 1) 0 }}
{{- $currentVer = replaceRE `^\/docs` "" $currentVer 1 }}
{{- if (or $currentVer (index (findRE `^\/docs\/[^\/]*\/` .Page.RelPermalink 1) 0)) }}
{{- $isNested = true }}
@@ -18,6 +18,8 @@
{{ range where .Site.Params.versions "url" $version }}
{{ $versionPath = .version }}
{{ end }}
+{{- else if eq $currentVer "/docs/latest/" }}
+ {{ $versionPath = "latest" }}
{{- else if $currentVer }}
{{ range where .Site.Params.versions "url" $currentVer }}
{{ $versionPath = .version }}
diff --git a/layouts/shortcodes/image.html b/layouts/shortcodes/image.html
index 56d5da3c4..6736be662 100644
--- a/layouts/shortcodes/image.html
+++ b/layouts/shortcodes/image.html
@@ -2,9 +2,9 @@
{{- $versionPath := "" }}
{{- /* Get the current version, and whether the website is currently nested (has /docs prepended). */}}
{{- $isNested := false }}
-{{- $currentVer := index (findRE `^\/docs\/[0-9\.]*\/` .Page.RelPermalink 1) 0 }}
+{{- $currentVer := index (findRE `^\/docs\/([0-9\.]*|latest)\/` .Page.RelPermalink 1) 0 }}
{{- if (not $currentVer) }}
- {{- $currentVer = index (findRE `^\/docs\/docs\/[0-9\.]*\/` .Page.RelPermalink 1) 0 }}
+ {{- $currentVer = index (findRE `^\/docs\/docs\/([0-9\.]*|latest)\/` .Page.RelPermalink 1) 0 }}
{{- $currentVer = replaceRE `^\/docs` "" $currentVer 1 }}
{{- if (or $currentVer (index (findRE `^\/docs\/[^\/]*\/` .Page.RelPermalink 1) 0)) }}
{{- $isNested = true }}
@@ -16,6 +16,8 @@
{{ range where .Site.Params.versions "url" $version }}
{{ $versionPath = .version }}
{{ end }}
+{{- else if eq $currentVer "/docs/latest/" }}
+ {{ $versionPath = "latest" }}
{{- else if $currentVer }}
{{ range where .Site.Params.versions "url" $currentVer }}
{{ $versionPath = .version }}
diff --git a/layouts/shortcodes/section.html b/layouts/shortcodes/section.html
index a94a46033..f2475e5b5 100644
--- a/layouts/shortcodes/section.html
+++ b/layouts/shortcodes/section.html
@@ -4,9 +4,9 @@
*/}}
{{ $filePath := .Get 0 }}
{{- /* Get the current version. */}}
-{{- $currentVer := index (findRE `^\/docs\/[0-9\.]*\/` .Page.RelPermalink 1) 0 }}
+{{- $currentVer := index (findRE `^\/docs\/([0-9\.]*|latest)\/` .Page.RelPermalink 1) 0 }}
{{- if (not $currentVer) }}
- {{- $currentVer = index (findRE `^\/docs\/docs\/[0-9\.]*\/` .Page.RelPermalink 1) 0 }}
+ {{- $currentVer = index (findRE `^\/docs\/docs\/([0-9\.]*|latest)\/` .Page.RelPermalink 1) 0 }}
{{- $currentVer = replaceRE `^\/docs` "" $currentVer 1 }}
{{- end }}
{{ $page := .Site.GetPage (printf "%s%s%s" $currentVer "_shared" $filePath) }}
diff --git a/layouts/shortcodes/url.html b/layouts/shortcodes/url.html
index 1c5a2c0a1..6ae7536aa 100644
--- a/layouts/shortcodes/url.html
+++ b/layouts/shortcodes/url.html
@@ -7,9 +7,9 @@
{{- $link := (printf "%s://%s%s" $url.Scheme $url.Host $url.Path) }}
{{- /* Get the current version, and whether the website is currently nested (has /docs prepended). */}}
{{- $isNested := false }}
-{{- $currentVer := index (findRE `^\/docs\/[0-9\.]*\/` .Page.RelPermalink 1) 0 }}
+{{- $currentVer := index (findRE `^\/docs\/([0-9\.]*|latest)\/` .Page.RelPermalink 1) 0 }}
{{- if (not $currentVer) }}
- {{- $currentVer = index (findRE `^\/docs\/docs\/[0-9\.]*\/` .Page.RelPermalink 1) 0 }}
+ {{- $currentVer = index (findRE `^\/docs\/docs\/([0-9\.]*|latest)\/` .Page.RelPermalink 1) 0 }}
{{- $currentVer = replaceRE `^\/docs` "" $currentVer 1 }}
{{- if (or $currentVer (index (findRE `^\/docs\/[^\/]*\/` .Page.RelPermalink 1) 0) ) }}
{{- $isNested = true }}
diff --git a/layouts/shortcodes/version.html b/layouts/shortcodes/version.html
index c949faa45..71062b5fb 100644
--- a/layouts/shortcodes/version.html
+++ b/layouts/shortcodes/version.html
@@ -4,9 +4,9 @@
*/}}
{{- /* Get the current version, setting to latest if not in a versioned page. */}}
{{- $isNested := false }}
-{{- $currentVer := index (findRE `^\/docs\/[0-9\.]*\/` .Page.RelPermalink 1) 0 }}
+{{- $currentVer := index (findRE `^\/docs\/([0-9\.]*|latest)\/` .Page.RelPermalink 1) 0 }}
{{- if (not $currentVer) }}
- {{- $currentVer = index (findRE `^\/docs\/docs\/[0-9\.]*\/` .Page.RelPermalink 1) 0 }}
+ {{- $currentVer = index (findRE `^\/docs\/docs\/([0-9\.]*|latest)\/` .Page.RelPermalink 1) 0 }}
{{- $currentVer = replaceRE `^\/docs` "" $currentVer 1 }}
{{- if (not $currentVer) }}
{{ range where .Site.Params.versions "latest" true }}
diff --git a/layouts/shortcodes/workinprogress.html b/layouts/shortcodes/workinprogress.html
index 1a4e40112..6aa25bdd8 100644
--- a/layouts/shortcodes/workinprogress.html
+++ b/layouts/shortcodes/workinprogress.html
@@ -1,15 +1,17 @@
{{- $versionPath := "" }}
{{- /* Get the current version, and whether the website is currently nested (has /docs prepended). */}}
{{- $isNested := false }}
-{{- $currentVer := index (findRE `^\/docs\/[0-9\.]*\/` .Page.RelPermalink 1) 0 }}
+{{- $currentVer := index (findRE `^\/docs\/([0-9\.]*|latest)\/` .Page.RelPermalink 1) 0 }}
{{- if (not $currentVer) }}
- {{- $currentVer = index (findRE `^\/docs\/docs\/[0-9\.]*\/` .Page.RelPermalink 1) 0 }}
+ {{- $currentVer = index (findRE `^\/docs\/docs\/([0-9\.]*|latest)\/` .Page.RelPermalink 1) 0 }}
{{- $currentVer = replaceRE `^\/docs` "" $currentVer 1 }}
{{- if (or $currentVer (index (findRE `^\/docs\/[^\/]*\/` .Page.RelPermalink 1) 0)) }}
{{- $isNested = true }}
{{- end }}
{{- end }}
-{{- if $currentVer }}
+{{- if eq $currentVer "/docs/latest/" }}
+ {{ $versionPath = "latest" }}
+{{- else if $currentVer }}
{{ range where .Site.Params.versions "url" $currentVer }}
{{ $versionPath = .version }}
{{ end }}
diff --git a/layouts/shortcodes/youtube.html b/layouts/shortcodes/youtube.html
index b9fde6170..b408648b8 100644
--- a/layouts/shortcodes/youtube.html
+++ b/layouts/shortcodes/youtube.html
@@ -1,9 +1,9 @@
{{- $versionPath := "" }}
{{- /* Get the current version, and whether the website is currently nested (has /docs prepended). */}}
{{- $isNested := false }}
-{{- $currentVer := index (findRE `^\/docs\/[0-9\.]*\/` .Page.RelPermalink 1) 0 }}
+{{- $currentVer := index (findRE `^\/docs\/([0-9\.]*|latest)\/` .Page.RelPermalink 1) 0 }}
{{- if (not $currentVer) }}
- {{- $currentVer = index (findRE `^\/docs\/docs\/[0-9\.]*\/` .Page.RelPermalink 1) 0 }}
+ {{- $currentVer = index (findRE `^\/docs\/docs\/([0-9\.]*|latest)\/` .Page.RelPermalink 1) 0 }}
{{- $currentVer = replaceRE `^\/docs` "" $currentVer 1 }}
{{- if (or $currentVer (index (findRE `^\/docs\/[^\/]*\/` .Page.RelPermalink 1) 0)) }}
{{- $isNested = true }}