Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/checklink.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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
retention-days: 7 # Default is 90 days
4 changes: 4 additions & 0 deletions .github/workflows/hugo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion .htmltest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down
27 changes: 27 additions & 0 deletions createLatest.ps1
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions layouts/partials/navbar-version-selector.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
31 changes: 31 additions & 0 deletions layouts/partials/section-index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<div class="section-index">
{{ $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 */}}
<ul>
{{ range $pages }}
{{ if eq .Parent $parent }}
<li><a href="{{ .RelPermalink }}">{{- .Title -}}</a></li>
{{ end }}
{{ end }}
</ul>
{{ else }}
{{/* Otherwise we show a nice formatted list of subpages with page descriptions */}}
<hr class="panel-line">
{{ range $pages }}
{{ if eq .Parent $parent }}
<div class="entry">
<h5>
<a href="{{ .RelPermalink }}">{{- .Title -}}</a>
</h5>
<p>{{ .Description | markdownify }}</p>
</div>
{{ end }}
{{ end }}
{{ end }}
</div>
4 changes: 2 additions & 2 deletions layouts/shortcodes/ahref.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
8 changes: 5 additions & 3 deletions layouts/shortcodes/figure.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand Down
6 changes: 4 additions & 2 deletions layouts/shortcodes/filelink.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand Down
6 changes: 4 additions & 2 deletions layouts/shortcodes/image.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand Down
4 changes: 2 additions & 2 deletions layouts/shortcodes/section.html
Original file line number Diff line number Diff line change
Expand Up @@ -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) }}
Expand Down
4 changes: 2 additions & 2 deletions layouts/shortcodes/url.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
4 changes: 2 additions & 2 deletions layouts/shortcodes/version.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
8 changes: 5 additions & 3 deletions layouts/shortcodes/workinprogress.html
Original file line number Diff line number Diff line change
@@ -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 }}
Expand Down
4 changes: 2 additions & 2 deletions layouts/shortcodes/youtube.html
Original file line number Diff line number Diff line change
@@ -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 }}
Expand Down