Site improvements (#4043)

- A few small additions that make it possible to build archive.istio.io
directly from here, instead of having a dedicated set of hacks in
the admin-sites repo.
This commit is contained in:
Martin Taillefer 2019-04-25 12:18:14 -07:00 committed by GitHub
parent 8d5c03b060
commit 93ee2d86f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 163 additions and 1 deletions

View File

@ -28,4 +28,7 @@ serve: build
@docker run -t -i --sig-proxy=true --rm -v $(shell pwd):/site -w /site -p 1313:1313 $(img) hugo serve --baseURL "http://${ISTIO_SERVE_DOMAIN}:1313/" --bind 0.0.0.0 --disableFastRender @docker run -t -i --sig-proxy=true --rm -v $(shell pwd):/site -w /site -p 1313:1313 $(img) hugo serve --baseURL "http://${ISTIO_SERVE_DOMAIN}:1313/" --bind 0.0.0.0 --disableFastRender
netlify: netlify:
@scripts/gen_site.sh "$(baseurl)" -minify -aliases @scripts/gen_site.sh "$(baseurl)" -minify
netlify_archive:
@scripts/gen_archive_site.sh "$(baseurl)" -minify

67
archive_config.toml Normal file
View File

@ -0,0 +1,67 @@
defaultContentLanguage = "en"
languageCode = "en-us"
metaDataFormat = "yaml"
title = "Istio"
uglyURLs = false
enableRobotsTXT = true
pluralizeListTitles = false
canonifyURLs = true
disableKinds = ["taxonomy", "taxonomyTerm"]
anchor = "smart"
enableGitInfo = true
enableEmoji = false
buildFuture = true
ignoreFiles = [ "OWNERS" ]
staticDir = ["static", "generated"]
# MARKDOWN
## Configuration for BlackFriday markdown parser: https://github.com/russross/blackfriday
[blackfriday]
plainIDAnchors = true
# See https://github.com/gohugoio/hugo/issues/2424
hrefTargetBlank = false
angledQuotes = false
latexDashes = true
extensions = [""]
[outputs]
home = ["HTML"]
section = ["HTML"]
[mediaTypes]
[mediaTypes."text/netlify"]
delimiter = ""
[outputFormats]
[outputFormats.RSS]
baseName = "feed"
[outputFormats.REDIR]
mediatype = "text/netlify"
baseName = "_redirects"
isPlainText = true
notAlternative = true
[related]
# Only include matches with rank >= threshold. This is a normalized rank between 0 and 100.
threshold = 80
# To get stable "See also" sections we, by default, exclude newer related pages.
includeNewer = true
# Will lower case keywords in both queries and in the indexes.
toLower = false
[[related.indices]]
name = "keywords"
weight = 150
[[related.indices]]
name = "tags"
weight = 100
# internationalization
[languages]
[languages.zh]
contentDir = "content_zh"
[languages.en]
contentDir = "content"

View File

@ -1,3 +1,5 @@
User-agent: * User-agent: *
Disallow: Disallow:
{{ if not .Site.Data.args.archive_landing -}}
Sitemap: {{ .Site.BaseURL }}/sitemap.xml Sitemap: {{ .Site.BaseURL }}/sitemap.xml
{{- end -}}

90
scripts/gen_archive_site.sh Executable file
View File

@ -0,0 +1,90 @@
#! /bin/bash
#
# Build the archive site
#
# List of name:tagOrBranch
TOBUILD=(
v1.0:release-1.0
v0.8:release-0.8
)
TOBUILD_JEKYLL=(
# v0.7:release-0.7
# v0.6:release-0.6
# v0.5:release-0.5
# v0.4:release-0.4
# v0.3:release-0.3
# v0.2:release-0.2
# v0.1:release-0.1
)
# Grab the latest version info
export TMP=$(mktemp -d)
cp data/versions.yml ${TMP}
# Prepare
mkdir ${TMP}/archive
#echo "names:" >> ${TMP}/archives.yml
for rel in "${TOBUILD[@]}"
do
NAME=$(echo $rel | cut -d : -f 1)
TAG=$(echo $rel | cut -d : -f 2)
BASEURL=$(echo /$NAME)
echo "### Building '$NAME' from $TAG for $BASEURL"
git clean -f
git checkout ${TAG}
cp ${TMP}/versions.yml data
scripts/gen_site.sh ${BASEURL}
mv public ${TMP}/archive/${NAME}
echo "- name: \"${NAME}\"" >> ${TMP}/archives.yml
done
for rel in "${TOBUILD_JEKYLL[@]}"
do
NAME=$(echo $rel | cut -d : -f 1)
TAG=$(echo $rel | cut -d : -f 2)
echo "### Building '$NAME' from $TAG"
git clean -f
git checkout ${TAG}
echo "baseurl: /$NAME" > config_override.yml
cp ${TMP}/versions.yml _data
bundle install
bundle exec jekyll build --config _config.yml,config_override.yml
mv _site ${TMP}/archive/${NAME}
echo "- name: \"${NAME}\"" >> ${TMP}/archives.yml
done
echo "### Building landing page"
git clean -f
git checkout master
# Grab the state
cp ${TMP}/archives.yml data
# Delete stuff we don't want in the archive_landing
rm -fr content_zh content
rm -fr static/talks
mkdir content content_zh
echo "" >content/_index.md
echo "" >content_zh/_index.md
cp archive_config.toml config.toml
sed "s/archive_landing: false/archive_landing: true/" <"data/args.yml" >${TMP}/args.yml
mv ${TMP}/args.yml data
scripts/gen_site.sh "https://archive.istio.io"
# fetch the older sites
mv ${TMP}/archive/* public
rm -fr ${TMP}
git clean -f
git checkout -- .
echo "All done!"