docs: show archived/pre-release banner based on version

Also clean up some stuff we're not going to use.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
This commit is contained in:
Andrey Smirnov 2022-03-24 21:51:14 +03:00
parent e403470bfe
commit 7a88a02241
No known key found for this signature in database
GPG Key ID: 7B26396447AB6DFD
6 changed files with 20 additions and 50 deletions

11
website/.gitignore vendored
View File

@ -1,10 +1 @@
*.log
.cache
.DS_Store
src/.temp
node_modules
dist
public
!.env.example
.env
.env.*
resources

View File

@ -1,3 +0,0 @@
FROM klakegg/hugo:ext-alpine
RUN apk add git

View File

@ -4,6 +4,7 @@ no_list: true
linkTitle: "Documentation"
cascade:
type: docs
preRelease: true
---
## Welcome

View File

@ -1,17 +0,0 @@
#Copyright 2018 Google LLC
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable law or agreed to in writing, software
#distributed under the License is distributed on an "AS IS" BASIS,
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#See the License for the specific language governing permissions and
#limitations under the License.
#
rm -rf public/
HUGO_ENV="production" hugo --gc || exit 1
s3deploy -source=public/ -region=eu-west-1 -bucket=bep.is -distribution-id=E8OKNT7W9ZYZ2 -path temp/td

View File

@ -1,13 +0,0 @@
version: "3.3"
services:
site:
image: docsy/docsy-example
build:
context: .
command: server
ports:
- "1313:1313"
volumes:
- .:/src

View File

@ -1,15 +1,26 @@
<!-- Check the variable that indicates whether this is an archived doc set.
If yes, display a banner. -->
{{ if .Site.Params.archived_version }}
{{ $latest_version := .Site.Params.url_latest_version }}
{{ $current_version := .Section | printf "/%s" }}
{{ if .FirstSection.Params.prerelease }}
{{ $color := "primary" }}
{{ $latest_version := .Site.Params.url_latest_version }}
{{ $current_version := .Site.Params.version }}
<div class="pageinfo pageinfo-{{ $color }}">
{{ with $current_version }}<p>Version {{ . | markdownify }} of the
{{ with $current_version }}<p>Version {{ trim . "/" | markdownify }} of the
documentation is for the Talos version being developed.
{{ with $latest_version }}For the latest stable version of Talos, see the
<a href="{{ $latest_version | safeURL }}">latest version</a>.</p>
{{ end }}
{{ end }}
</div>
{{ else if ne $latest_version $current_version }}
{{ $color := "primary" }}
<div class="pageinfo pageinfo-{{ $color }}">
{{ with $current_version }}<p>Version {{ trim . "/" | markdownify }} of the
documentation is no longer actively maintained. The site that you are
currently viewing is an archived snapshot.
{{ with $latest_version }}For up-to-date documentation, see the
<a href="{{ $latest_version | safeURL }}" target="_blank">latest version</a>.</p>
currently viewing is an archived snapshot.
{{ with $latest_version }}For up-to-date documentation, see the
<a href="{{ $latest_version | safeURL }}">latest version</a>.</p>
{{ end }}
{{ end }}
</div>