-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix warning for preview/stable * add fix for version less pages and add links only they exist * pushing minor change to trigger re-build * add warn for debugging * Apply suggestions from code review Co-authored-by: Dwight Hodge <[email protected]> * Changes to force build * adding a error * removing the error * adding space to wrappers * disabling netlify-plugin-hugo-cache-resources * re-enabling netlify-plugin-hugo-cache-resources * removing spaces in wrappers * creating a new shortcode to trigger full build * creating a new shortcode to trigger full build * text edit * add the path correctly * revert changes used to trigger rebuilds * revert space add * text edits --------- Co-authored-by: Dwight Hodge <[email protected]> Co-authored-by: Dwight Hodge <[email protected]>
- Loading branch information
1 parent
e8f09b5
commit ee479ee
Showing
4 changed files
with
81 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,73 @@ | ||
{{ if not (eq ($.Scratch.Get "docVersion") "preview") }} | ||
{{ $docVersion := $.Scratch.Get "docVersion" }} | ||
{{ $urlArray := split (urls.Parse .Permalink).Path "/" }} | ||
{{ $previewUrl := path.Join "preview" (after 2 $urlArray) }} | ||
{{ $previewUrl = add (add "/" $previewUrl) "/" }} | ||
{{ $previewVersion := "" }} | ||
{{ $docVersion := $.Scratch.Get "docVersion" }} | ||
{{ $urlArray := split (urls.Parse .Permalink).Path "/" }} | ||
{{ $previewUrl := path.Join "preview" (after 2 $urlArray) }} | ||
{{ $previewUrl = add (add "/" $previewUrl) "/" }} | ||
{{ $stableUrl := path.Join "stable" (after 2 $urlArray) }} | ||
{{ $stableUrl = add (add "/" $stableUrl) "/" }} | ||
{{ $previewVersion := "" }} | ||
{{ $stableVersion := "" }} | ||
{{ $previewBehindStable := false }} | ||
{{ $fullpath := printf "%s" .Page.File.Path}} | ||
{{ $pathsplit := after 1 (split $fullpath "/")}} | ||
{{/** Keep track of whether preview version exists for this file **/}} | ||
{{ $previewPath := path.Join "content/preview" $pathsplit }} | ||
{{ $previewExists := fileExists $previewPath }} | ||
|
||
{{- if .Site.Params.yb.preview_version -}} | ||
{{ $previewVersion = printf "(%s)" .Site.Params.yb.preview_version }} | ||
{{/** Keep track of whether stable version exists for this file **/}} | ||
{{ $stablePath := path.Join "content/stable" $pathsplit }} | ||
{{ $stableExists := fileExists $stablePath }} | ||
|
||
{{ warnf "%s(%s) - %s(%s)" $previewPath $previewExists $stablePath $stableExists }} | ||
|
||
{{/** Identify is preview is behind stable and which versions are preview and stable **/}} | ||
{{ range .Site.Data.currentVersions.dbVersions }} | ||
{{- if eq .alias "stable" -}} | ||
{{ $stableVersion = .series -}} | ||
{{- if in .PreviewBehindStable true -}} | ||
{{ $previewBehindStable = true }} | ||
{{- end -}} | ||
{{- else if eq .alias "preview" -}} | ||
{{- $previewVersion = .series -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/** Do nothing if this is the latest stable and preview is behind stable **/}} | ||
{{- if not (and (eq $docVersion "stable") $previewBehindStable) -}} | ||
{{ range .Site.Data.currentVersions.dbVersions }} | ||
{{- if not (in .PreviewBehindStable true) -}} | ||
{{- if or (eq $docVersion .series) (eq $docVersion .alias) -}} | ||
<div class="admonition note"> | ||
{{/** for LTS and STS **/}} | ||
{{- if or (eq .isLTS true) (eq .isSTS true) -}} | ||
<!-- <p class="admonition-title">Attention</p> --> | ||
<p>This page documents a stable (production) version. For testing and development with the latest features, use the <a href="{{ $previewUrl }}">preview {{ $previewVersion }} version.</a></p> | ||
{{/** Do nothing if preview does not exist for this file **/}} | ||
{{- if $previewExists -}} | ||
<div class="admonition note"> | ||
<p>This page documents a stable (production) version. For testing and development with the latest features, | ||
use the <a href="{{ $previewUrl }}">preview</a> version ({{ $previewVersion }}). | ||
{{/** For older stable versions, Add link to latest stable **/}} | ||
{{ if not (eq .alias "stable") }} | ||
For the latest stable version, see <a href="{{ $stableUrl }}">{{ $stableVersion }}</a>. | ||
{{- end -}} | ||
</p> | ||
</div> | ||
{{- end -}} | ||
{{- else if eq .alias "preview" -}} | ||
{{/** If a stable page does not exist, this is an unversioned page!!!! **/}} | ||
{{- if $stableExists -}} | ||
<div class="admonition warning"> | ||
<p>This page documents the preview version ({{ $previewVersion }}). Preview includes features under active development and is for development and testing only. | ||
For production, use the <a href="{{ $stableUrl }}"> stable</a> version ({{ $stableVersion }}). To learn more, see <a href="/preview/releases/versioning/">Versioning</a>.</p> | ||
</div> | ||
{{- end -}} | ||
{{- else -}} | ||
<!-- <p class="admonition-title">Attention</p> --> | ||
<p>This page documents an earlier version. <a href="{{ $previewUrl }}">Go to the preview {{ $previewVersion }} version.</a></p> | ||
{{- if and $previewBehindStable $stableExists }} | ||
<div class="admonition note"> | ||
<p>This page documents an earlier version. Go to the <a href="{{ $stableUrl }}">stable</a> version ({{ $stableVersion }}).</p> | ||
</div> | ||
{{- else if $previewExists -}} | ||
<div class="admonition note"> | ||
<p>This page documents an earlier version. Go to the <a href="{{ $previewUrl }}">preview</a> version ({{ $previewVersion }}).</p> | ||
</div> | ||
{{- end -}} | ||
{{- end -}} | ||
</div> | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{ end }} | ||
{{- end -}} |