Hugo migration (#2720)
* Move files to a Hugo structure Signed-off-by: Tony Batard <tbatard@pivotal.io>pull/2817/head
parent
681123596f
commit
c663ce15ab
|
@ -38,14 +38,8 @@ Tiltfile
|
|||
.vscode
|
||||
*.diff
|
||||
|
||||
# Jekyll compiled data
|
||||
site/_site
|
||||
site/.sass-cache
|
||||
site/.jekyll
|
||||
site/.jekyll-metadata
|
||||
site/.jekyll-cache
|
||||
site/.bundle
|
||||
site/vendor
|
||||
.ruby-version
|
||||
# Hugo compiled data
|
||||
site/public
|
||||
site/resources
|
||||
|
||||
.vs
|
||||
|
|
19
Makefile
19
Makefile
|
@ -36,6 +36,8 @@ BUILDER_IMAGE_TAG := $(shell git log -1 --pretty=%h hack/build-image/Dockerfile)
|
|||
BUILDER_IMAGE := $(REGISTRY)/build-image:$(BUILDER_IMAGE_TAG)
|
||||
BUILDER_IMAGE_CACHED := $(shell docker images -q ${BUILDER_IMAGE} 2>/dev/null )
|
||||
|
||||
HUGO_IMAGE := hugo-builder
|
||||
|
||||
# Which architecture to build - see $(ALL_ARCH) for options.
|
||||
# if the 'local' rule is being run, detect the ARCH from 'go env'
|
||||
# if it wasn't specified by the caller.
|
||||
|
@ -264,6 +266,9 @@ push-build-image:
|
|||
@# credentials needed to accomplish this.
|
||||
docker push $(BUILDER_IMAGE)
|
||||
|
||||
build-image-hugo:
|
||||
cd site && docker build --pull -t $(HUGO_IMAGE) .
|
||||
|
||||
clean:
|
||||
# if we have a cached image then use it to run go clean --modcache
|
||||
# this test checks if we there is an image id in the BUILDER_IMAGE_CACHED variable.
|
||||
|
@ -272,6 +277,7 @@ ifneq ($(strip $(BUILDER_IMAGE_CACHED)),)
|
|||
docker rmi -f $(BUILDER_IMAGE) || true
|
||||
endif
|
||||
rm -rf .go _output
|
||||
docker rmi $(HUGO_IMAGE)
|
||||
|
||||
|
||||
.PHONY: modules
|
||||
|
@ -314,14 +320,13 @@ release:
|
|||
PUBLISH=$(PUBLISH) \
|
||||
./hack/goreleaser.sh'"
|
||||
|
||||
serve-docs:
|
||||
serve-docs: build-image-hugo
|
||||
docker run \
|
||||
--rm \
|
||||
-v "$$(pwd)/site:/srv/jekyll" \
|
||||
-it -p 4000:4000 \
|
||||
jekyll/jekyll \
|
||||
jekyll serve --livereload --incremental
|
||||
|
||||
-v "$$(pwd)/site:/srv/hugo" \
|
||||
-it -p 1313:1313 \
|
||||
$(HUGO_IMAGE) \
|
||||
hugo server --bind=0.0.0.0 --enableGitInfo=false
|
||||
# gen-docs generates a new versioned docs directory under site/docs. It follows
|
||||
# the following process:
|
||||
# 1. Copies the contents of the most recently tagged docs directory into the new
|
||||
|
@ -333,7 +338,7 @@ serve-docs:
|
|||
# 4. Copies the previous version's ToC file and runs 'git add' to establish
|
||||
# a useful baseline to diff against.
|
||||
# 5. Replaces the content of the new ToC file with the master ToC.
|
||||
# 6. Update site/_config.yml and site/_data/toc-mapping.yml to include entries
|
||||
# 6. Update site/config.yaml and site/_data/toc-mapping.yml to include entries
|
||||
# for the new version.
|
||||
#
|
||||
# The unstaged changes in the working directory can now easily be diff'ed against the
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Migrate site from Jekyll to Hugo
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2019 the Velero contributors.
|
||||
# Copyright 2020 the Velero contributors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -21,88 +21,94 @@ set -o errexit
|
|||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
DOCS_DIRECTORY=site/content/docs
|
||||
DATA_DOCS_DIRECTORY=site/data/docs
|
||||
CONFIG_FILE=site/config.yaml
|
||||
MAIN_BRANCH=main
|
||||
|
||||
# don't run if there's already a directory for the target docs version
|
||||
if [[ -d site/docs/$NEW_DOCS_VERSION ]]; then
|
||||
echo "ERROR: site/docs/$NEW_DOCS_VERSION already exists"
|
||||
if [[ -d $DOCS_DIRECTORY/$NEW_DOCS_VERSION ]]; then
|
||||
echo "ERROR: $DOCS_DIRECTORY/$NEW_DOCS_VERSION already exists"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# get the alphabetically last item in site/docs to use as PREVIOUS_DOCS_VERSION
|
||||
# get the alphabetically last item in $DOCS_DIRECTORY to use as PREVIOUS_DOCS_VERSION
|
||||
# if not explicitly specified by the user
|
||||
if [[ -z "${PREVIOUS_DOCS_VERSION:-}" ]]; then
|
||||
echo "PREVIOUS_DOCS_VERSION was not specified, getting the latest version"
|
||||
PREVIOUS_DOCS_VERSION=$(ls -1 site/docs/ | tail -n 1)
|
||||
PREVIOUS_DOCS_VERSION=$(ls -1 $DOCS_DIRECTORY/ | tail -n 1)
|
||||
fi
|
||||
|
||||
# make a copy of the previous versioned docs dir
|
||||
echo "Creating copy of docs directory site/docs/$PREVIOUS_DOCS_VERSION in site/docs/$NEW_DOCS_VERSION"
|
||||
cp -r site/docs/${PREVIOUS_DOCS_VERSION}/ site/docs/${NEW_DOCS_VERSION}/
|
||||
echo "Creating copy of docs directory $DOCS_DIRECTORY/$PREVIOUS_DOCS_VERSION in $DOCS_DIRECTORY/$NEW_DOCS_VERSION"
|
||||
cp -r $DOCS_DIRECTORY/${PREVIOUS_DOCS_VERSION}/ $DOCS_DIRECTORY/${NEW_DOCS_VERSION}/
|
||||
|
||||
# 'git add' the previous version's docs as-is so we get a useful diff when we copy the main docs in
|
||||
# 'git add' the previous version's docs as-is so we get a useful diff when we copy the $MAIN_BRANCH docs in
|
||||
echo "Running 'git add' for previous version's doc contents to use as a base for diff"
|
||||
git add site/docs/${NEW_DOCS_VERSION}
|
||||
git add -f $DOCS_DIRECTORY/${NEW_DOCS_VERSION}
|
||||
|
||||
# now copy the contents of site/docs/main into the same directory so we can get a nice
|
||||
# now copy the contents of $DOCS_DIRECTORY/$MAIN_BRANCH into the same directory so we can get a nice
|
||||
# git diff of what changed since previous version
|
||||
echo "Copying site/docs/main/ to site/docs/${NEW_DOCS_VERSION}/"
|
||||
rm -rf site/docs/${NEW_DOCS_VERSION}/ && cp -r site/docs/main/ site/docs/${NEW_DOCS_VERSION}/
|
||||
echo "Copying $DOCS_DIRECTORY/$MAIN_BRANCH/ to $DOCS_DIRECTORY/${NEW_DOCS_VERSION}/"
|
||||
rm -rf $DOCS_DIRECTORY/${NEW_DOCS_VERSION}/ && cp -r $DOCS_DIRECTORY/$MAIN_BRANCH/ $DOCS_DIRECTORY/${NEW_DOCS_VERSION}/
|
||||
|
||||
# make a copy of the previous versioned ToC
|
||||
NEW_DOCS_TOC="$(echo ${NEW_DOCS_VERSION} | tr . -)-toc"
|
||||
PREVIOUS_DOCS_TOC="$(echo ${PREVIOUS_DOCS_VERSION} | tr . -)-toc"
|
||||
|
||||
echo "Creating copy of site/_data/$PREVIOUS_DOCS_TOC.yml at site/_data/$NEW_DOCS_TOC.yml"
|
||||
cp site/_data/$PREVIOUS_DOCS_TOC.yml site/_data/$NEW_DOCS_TOC.yml
|
||||
echo "Creating copy of $DATA_DOCS_DIRECTORY/$PREVIOUS_DOCS_TOC.yml at $DATA_DOCS_DIRECTORY/$NEW_DOCS_TOC.yml"
|
||||
cp $DATA_DOCS_DIRECTORY/$PREVIOUS_DOCS_TOC.yml $DATA_DOCS_DIRECTORY/$NEW_DOCS_TOC.yml
|
||||
|
||||
# 'git add' the previous version's ToC content as-is so we get a useful diff when we copy the main ToC in
|
||||
# 'git add' the previous version's ToC content as-is so we get a useful diff when we copy the $MAIN_BRANCH ToC in
|
||||
echo "Running 'git add' for previous version's ToC to use as a base for diff"
|
||||
git add site/_data/$NEW_DOCS_TOC.yml
|
||||
git add $DATA_DOCS_DIRECTORY/$NEW_DOCS_TOC.yml
|
||||
|
||||
# now copy the main ToC so we can get a nice git diff of what changed since previous version
|
||||
echo "Copying site/_data/main-toc.yml to site/_data/$NEW_DOCS_TOC.yml"
|
||||
rm site/_data/$NEW_DOCS_TOC.yml && cp site/_data/main-toc.yml site/_data/$NEW_DOCS_TOC.yml
|
||||
# now copy the $MAIN_BRANCH ToC so we can get a nice git diff of what changed since previous version
|
||||
echo "Copying $DATA_DOCS_DIRECTORY/$MAIN_BRANCH-toc.yml to $DATA_DOCS_DIRECTORY/$NEW_DOCS_TOC.yml"
|
||||
rm $DATA_DOCS_DIRECTORY/$NEW_DOCS_TOC.yml && cp $DATA_DOCS_DIRECTORY/$MAIN_BRANCH-toc.yml $DATA_DOCS_DIRECTORY/$NEW_DOCS_TOC.yml
|
||||
|
||||
# replace known version-specific links -- the sed syntax is slightly different in OS X and Linux,
|
||||
# so check which OS we're running on.
|
||||
if [[ $(uname) == "Darwin" ]]; then
|
||||
echo "[OS X] updating version-specific links"
|
||||
find site/docs/${NEW_DOCS_VERSION} -type f -name "*.md" | xargs sed -i '' "s|https://velero.io/docs/main|https://velero.io/docs/$VELERO_VERSION|g"
|
||||
find site/docs/${NEW_DOCS_VERSION} -type f -name "*.md" | xargs sed -i '' "s|https://github.com/vmware-tanzu/velero/blob/main|https://github.com/vmware-tanzu/velero/blob/$VELERO_VERSION|g"
|
||||
find $DOCS_DIRECTORY/${NEW_DOCS_VERSION} -type f -name "*.md" | xargs sed -i '' "s|https://velero.io/docs/$MAIN_BRANCH|https://velero.io/docs/$VELERO_VERSION|g"
|
||||
find $DOCS_DIRECTORY/${NEW_DOCS_VERSION} -type f -name "*.md" | xargs sed -i '' "s|https://github.com/vmware-tanzu/velero/blob/$MAIN_BRANCH|https://github.com/vmware-tanzu/velero/blob/$VELERO_VERSION|g"
|
||||
find $DOCS_DIRECTORY/${NEW_DOCS_VERSION} -type f -name "_index.md" | xargs sed -i '' "s|version: $MAIN_BRANCH|version: $NEW_DOCS_VERSION|g"
|
||||
|
||||
echo "[OS X] Updating latest version in _config.yml"
|
||||
sed -i '' "s/latest: ${PREVIOUS_DOCS_VERSION}/latest: ${NEW_DOCS_VERSION}/" site/_config.yml
|
||||
echo "[OS X] Updating latest version in $CONFIG_FILE"
|
||||
sed -i '' "s/latest: ${PREVIOUS_DOCS_VERSION}/latest: ${NEW_DOCS_VERSION}/" $CONFIG_FILE
|
||||
|
||||
# newlines and lack of indentation are requirements for this sed syntax
|
||||
# which is doing an append
|
||||
echo "[OS X] Adding latest version to versions list in _config.yml"
|
||||
sed -i '' "/- main/a\\
|
||||
- ${NEW_DOCS_VERSION}
|
||||
" site/_config.yml
|
||||
echo "[OS X] Adding latest version to versions list in $CONFIG_FILE"
|
||||
sed -i '' "/- $MAIN_BRANCH/a\\
|
||||
\ \ \ \ - ${NEW_DOCS_VERSION}
|
||||
" $CONFIG_FILE
|
||||
|
||||
echo "[OS X] Adding ToC mapping entry"
|
||||
sed -i '' "/main: main-toc/a\\
|
||||
sed -i '' "/$MAIN_BRANCH: $MAIN_BRANCH-toc/a\\
|
||||
${NEW_DOCS_VERSION}: ${NEW_DOCS_TOC}
|
||||
" site/_data/toc-mapping.yml
|
||||
" $DATA_DOCS_DIRECTORY/toc-mapping.yml
|
||||
|
||||
else
|
||||
echo "[Linux] updating version-specific links"
|
||||
find site/docs/${NEW_DOCS_VERSION} -type f -name "*.md" | xargs sed -i'' "s|https://velero.io/docs/main|https://velero.io/docs/$VELERO_VERSION|g"
|
||||
find site/docs/${NEW_DOCS_VERSION} -type f -name "*.md" | xargs sed -i'' "s|https://github.com/vmware-tanzu/velero/blob/main|https://github.com/vmware-tanzu/velero/blob/$VELERO_VERSION|g"
|
||||
find $DOCS_DIRECTORY/${NEW_DOCS_VERSION} -type f -name "*.md" | xargs sed -i'' "s|https://velero.io/docs/$MAIN_BRANCH|https://velero.io/docs/$VELERO_VERSION|g"
|
||||
find $DOCS_DIRECTORY/${NEW_DOCS_VERSION} -type f -name "*.md" | xargs sed -i'' "s|https://github.com/vmware-tanzu/velero/blob/$MAIN_BRANCH|https://github.com/vmware-tanzu/velero/blob/$VELERO_VERSION|g"
|
||||
|
||||
echo "[Linux] Updating latest version in _config.yml"
|
||||
sed -i'' "s/latest: ${PREVIOUS_DOCS_VERSION}/latest: ${NEW_DOCS_VERSION}/" site/_config.yml
|
||||
echo "[Linux] Updating latest version in $CONFIG_FILE"
|
||||
sed -i'' "s/latest: ${PREVIOUS_DOCS_VERSION}/latest: ${NEW_DOCS_VERSION}/" $CONFIG_FILE
|
||||
|
||||
echo "[Linux] Adding latest version to versions list in _config.yml"
|
||||
sed -i'' "/- main/a - ${NEW_DOCS_VERSION}" site/_config.yml
|
||||
echo "[Linux] Adding latest version to versions list in $CONFIG_FILE"
|
||||
sed -i'' "/- $MAIN_BRANCH/a - ${NEW_DOCS_VERSION}" $CONFIG_FILE
|
||||
|
||||
echo "[Linux] Adding ToC mapping entry"
|
||||
sed -i'' "/main: main-toc/a ${NEW_DOCS_VERSION}: ${NEW_DOCS_TOC}" site/_data/toc-mapping.yml
|
||||
sed -i'' "/$MAIN_BRANCH: $MAIN_BRANCH-toc/a ${NEW_DOCS_VERSION}: ${NEW_DOCS_TOC}" $DATA_DOCS_DIRECTORY/toc-mapping.yml
|
||||
fi
|
||||
|
||||
echo "Success! site/docs/$NEW_DOCS_VERSION has been created."
|
||||
echo "Success! $DOCS_DIRECTORY/$NEW_DOCS_VERSION has been created."
|
||||
echo ""
|
||||
echo "The next steps are:"
|
||||
echo " 1. Consult site/README-JEKYLL.md for further manual steps required to finalize the new versioned docs generation."
|
||||
echo " 1. Consult site/README-HUGO.md for further manual steps required to finalize the new versioned docs generation."
|
||||
echo " 2. Run a 'git diff' to review all changes made to the docs since the previous version."
|
||||
echo " 3. Make any manual changes/corrections necessary."
|
||||
echo " 4. Run 'git add' to stage all unstaged changes, then 'git commit'."
|
||||
|
|
14
netlify.toml
14
netlify.toml
|
@ -1,10 +1,12 @@
|
|||
[build]
|
||||
base = "site/"
|
||||
command = "jekyll build"
|
||||
publish = "site/_site"
|
||||
command = "hugo --gc --minify --baseURL $BASE_URL"
|
||||
publish = "site/public"
|
||||
|
||||
# Using the * -> :splat rule should redirect anything under master to the matching file under main
|
||||
[[redirects]]
|
||||
from = "/docs/master/*"
|
||||
to = "/docs/main/:splat"
|
||||
[context.production.environment]
|
||||
HUGO_VERSION = "0.73.0"
|
||||
BASE_URL = "https://velero.io"
|
||||
|
||||
[context.deploy-preview.environment]
|
||||
HUGO_VERSION = "0.73.0"
|
||||
BASE_URL = "https://deploy-preview-2720--velero.netlify.app"
|
|
@ -0,0 +1,9 @@
|
|||
FROM ubuntu:20.04
|
||||
|
||||
RUN apt update
|
||||
RUN apt install -y hugo
|
||||
|
||||
WORKDIR /srv/hugo
|
||||
|
||||
EXPOSE 1313
|
||||
|
12
site/Gemfile
12
site/Gemfile
|
@ -1,12 +0,0 @@
|
|||
source 'https://rubygems.org'
|
||||
gem 'jekyll', '~> 4.1.0'
|
||||
gem 'jekyll-feed', '~> 0.13.0'
|
||||
gem 'jekyll-optional-front-matter', '~> 0.3.2'
|
||||
gem 'jekyll-paginate', '~> 1.1'
|
||||
gem 'jekyll-readme-index', '~> 0.3.0'
|
||||
gem 'jekyll-redirect-from', '~> 0.16.0'
|
||||
gem 'jekyll-relative-links', '~> 0.6.1'
|
||||
gem 'jekyll-sitemap', '~> 1.4'
|
||||
gem 'jekyll-titles-from-headings', '~> 0.5.3'
|
||||
gem 'jekyll-seo-tag', '~> 2.6', '>= 2.6.1'
|
||||
gem 'jemoji'
|
|
@ -1,116 +0,0 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
activesupport (6.0.3.1)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
zeitwerk (~> 2.2, >= 2.2.2)
|
||||
addressable (2.7.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
colorator (1.1.0)
|
||||
concurrent-ruby (1.1.6)
|
||||
em-websocket (0.5.1)
|
||||
eventmachine (>= 0.12.9)
|
||||
http_parser.rb (~> 0.6.0)
|
||||
eventmachine (1.2.7)
|
||||
ffi (1.13.1)
|
||||
forwardable-extended (2.6.0)
|
||||
gemoji (3.0.1)
|
||||
html-pipeline (2.13.0)
|
||||
activesupport (>= 2)
|
||||
nokogiri (>= 1.4)
|
||||
http_parser.rb (0.6.0)
|
||||
i18n (1.8.3)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jekyll (4.1.0)
|
||||
addressable (~> 2.4)
|
||||
colorator (~> 1.0)
|
||||
em-websocket (~> 0.5)
|
||||
i18n (~> 1.0)
|
||||
jekyll-sass-converter (~> 2.0)
|
||||
jekyll-watch (~> 2.0)
|
||||
kramdown (~> 2.1)
|
||||
kramdown-parser-gfm (~> 1.0)
|
||||
liquid (~> 4.0)
|
||||
mercenary (~> 0.4.0)
|
||||
pathutil (~> 0.9)
|
||||
rouge (~> 3.0)
|
||||
safe_yaml (~> 1.0)
|
||||
terminal-table (~> 1.8)
|
||||
jekyll-feed (0.13.0)
|
||||
jekyll (>= 3.7, < 5.0)
|
||||
jekyll-optional-front-matter (0.3.2)
|
||||
jekyll (>= 3.0, < 5.0)
|
||||
jekyll-paginate (1.1.0)
|
||||
jekyll-readme-index (0.3.0)
|
||||
jekyll (>= 3.0, < 5.0)
|
||||
jekyll-redirect-from (0.16.0)
|
||||
jekyll (>= 3.3, < 5.0)
|
||||
jekyll-relative-links (0.6.1)
|
||||
jekyll (>= 3.3, < 5.0)
|
||||
jekyll-sass-converter (2.1.0)
|
||||
sassc (> 2.0.1, < 3.0)
|
||||
jekyll-seo-tag (2.6.1)
|
||||
jekyll (>= 3.3, < 5.0)
|
||||
jekyll-sitemap (1.4.0)
|
||||
jekyll (>= 3.7, < 5.0)
|
||||
jekyll-titles-from-headings (0.5.3)
|
||||
jekyll (>= 3.3, < 5.0)
|
||||
jekyll-watch (2.2.1)
|
||||
listen (~> 3.0)
|
||||
jemoji (0.12.0)
|
||||
gemoji (~> 3.0)
|
||||
html-pipeline (~> 2.2)
|
||||
jekyll (>= 3.0, < 5.0)
|
||||
kramdown (2.3.0)
|
||||
rexml
|
||||
kramdown-parser-gfm (1.1.0)
|
||||
kramdown (~> 2.0)
|
||||
liquid (4.0.3)
|
||||
listen (3.2.1)
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
mercenary (0.4.0)
|
||||
mini_portile2 (2.4.0)
|
||||
minitest (5.14.1)
|
||||
nokogiri (1.10.9)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
pathutil (0.16.2)
|
||||
forwardable-extended (~> 2.6)
|
||||
public_suffix (4.0.5)
|
||||
rb-fsevent (0.10.4)
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
rexml (3.2.4)
|
||||
rouge (3.20.0)
|
||||
safe_yaml (1.0.5)
|
||||
sassc (2.4.0)
|
||||
ffi (~> 1.9)
|
||||
terminal-table (1.8.0)
|
||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
||||
thread_safe (0.3.6)
|
||||
tzinfo (1.2.7)
|
||||
thread_safe (~> 0.1)
|
||||
unicode-display_width (1.7.0)
|
||||
zeitwerk (2.3.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
jekyll (~> 4.1.0)
|
||||
jekyll-feed (~> 0.13.0)
|
||||
jekyll-optional-front-matter (~> 0.3.2)
|
||||
jekyll-paginate (~> 1.1)
|
||||
jekyll-readme-index (~> 0.3.0)
|
||||
jekyll-redirect-from (~> 0.16.0)
|
||||
jekyll-relative-links (~> 0.6.1)
|
||||
jekyll-seo-tag (~> 2.6, >= 2.6.1)
|
||||
jekyll-sitemap (~> 1.4)
|
||||
jekyll-titles-from-headings (~> 0.5.3)
|
||||
jemoji
|
||||
|
||||
BUNDLED WITH
|
||||
2.1.4
|
|
@ -0,0 +1,46 @@
|
|||
# Running in Docker
|
||||
|
||||
To run this site in a Docker container, you can use `make serve-docs` from the root directory.
|
||||
|
||||
# Dependencies for MacOS
|
||||
|
||||
Install the following for an easy to use dev environment:
|
||||
|
||||
* `brew install hugo`
|
||||
|
||||
# Dependencies for Linux
|
||||
If you are running a build on Ubuntu you will need the following packages:
|
||||
* hugo
|
||||
|
||||
|
||||
# Local Development
|
||||
1. Clone down your own fork, or clone the main repo `git clone https://github.com/vmware-tanzu/velero` and add your own remote.
|
||||
1. `cd velero/site`
|
||||
1. Serve the site and watch for markup/sass changes `hugo serve`.
|
||||
1. View your website at http://127.0.0.1:1313/
|
||||
1. Commit any changes and push everything to your fork.
|
||||
1. Once you're ready, submit a PR of your changes. Netlify will automatically generate a preview of your changes.
|
||||
|
||||
# Jetbrains IDE setup (IntelliJ, Goland, etc)
|
||||
1. Install the `Hugo Integration` plugin: https://plugins.jetbrains.com/plugin/13215-hugo-integration
|
||||
- Under `Preferences...` -> `Plugins`
|
||||
1. Create a new configuration:
|
||||
- Click `Edit Configurations...`
|
||||
- Click the `+` button to create a new configuration and select `Hugo`
|
||||
- Select `hugo serve` and make sure it is running under the `site` directory
|
||||
- Save and run the new Configuration
|
||||
- View your website at http://127.0.0.1:1313/
|
||||
- Any changes in `site` will reload the website automatically
|
||||
|
||||
# Adding a New Docs Version
|
||||
|
||||
To add a new set of versioned docs to go with a new Velero release:
|
||||
|
||||
1. In the root of the repository, run:
|
||||
|
||||
```bash
|
||||
# set to the appropriate version numbers
|
||||
NEW_DOCS_VERSION=vX.Y VELERO_VERSION=vX.Y.Z make gen-docs
|
||||
```
|
||||
|
||||
1. [Pre-release only] In `site/config.yaml`, revert the change to the `latest` field, so the pre-release docs do not become the default.
|
|
@ -1,49 +0,0 @@
|
|||
# Running in Docker
|
||||
|
||||
To run this site in a Docker container, you can use `make serve-docs` from the root directory.
|
||||
|
||||
# Dependencies for MacOS
|
||||
|
||||
Install the following for an easy to use dev environment:
|
||||
|
||||
* `brew install rbenv`
|
||||
* `rbenv install 2.6.3`
|
||||
* `gem install bundler`
|
||||
|
||||
# Dependencies for Linux
|
||||
If you are running a build on Ubuntu you will need the following packages:
|
||||
* ruby
|
||||
* ruby-dev
|
||||
* ruby-bundler
|
||||
* build-essential
|
||||
* zlib1g-dev
|
||||
* nginx (or apache2)
|
||||
|
||||
|
||||
# Local Development
|
||||
1. Install Jekyll and plug-ins in one fell swoop. `gem install github-pages`
|
||||
This mirrors the plug-ins used by GitHub Pages on your local machine including Jekyll, Sass, etc.
|
||||
2. Clone down your own fork, or clone the main repo `git clone https://github.com/vmware-tanzu/velero` and add your own remote.
|
||||
3. `cd velero/site`
|
||||
4. `rbenv local 2.6.3`
|
||||
5. `bundle install`
|
||||
6. Serve the site and watch for markup/sass changes `jekyll serve --livereload --incremental`. You may need to run `bundle exec jekyll serve --livereload --incremental`.
|
||||
7. View your website at http://127.0.0.1:4000/
|
||||
8. Commit any changes and push everything to your fork.
|
||||
9. Once you're ready, submit a PR of your changes. Netlify will automatically generate a preview of your changes.
|
||||
|
||||
|
||||
# Adding a New Docs Version
|
||||
|
||||
To add a new set of versioned docs to go with a new Velero release:
|
||||
|
||||
1. In the root of the repository, run:
|
||||
|
||||
```bash
|
||||
# set to the appropriate version numbers
|
||||
NEW_DOCS_VERSION=vX.Y VELERO_VERSION=vX.Y.Z make gen-docs
|
||||
```
|
||||
|
||||
1. In `site/_config.yml`, under the `defaults` field, add an entry for the new version just under `main` by copying the most recent version's entry and updating the version numbers.
|
||||
|
||||
1. [Pre-release only] In `site/_config.yml`, revert the change to the `latest` field, so the pre-release docs do not become the default.
|
233
site/_config.yml
233
site/_config.yml
|
@ -1,233 +0,0 @@
|
|||
# Site settings
|
||||
title: Velero
|
||||
email:
|
||||
author: Velero Authors
|
||||
description: Backup and migrate Kubernetes resources and persistent volumes
|
||||
#url: velero.io
|
||||
logo: Velero.svg
|
||||
twitter:
|
||||
username: projectvelero
|
||||
card: summary
|
||||
vm_logo: vm-logo.png
|
||||
gh_repo: https://github.com/vmware-tanzu/velero
|
||||
markdown: kramdown
|
||||
hero:
|
||||
background-color: med-blue
|
||||
footer:
|
||||
title: Getting Started
|
||||
content: To help you get started, see the documentation.
|
||||
cta_title: ''
|
||||
cta_url: /docs
|
||||
cta_text: Documentation
|
||||
vm-link: http://vmware.github.io/
|
||||
|
||||
footer_social_links:
|
||||
Twitter:
|
||||
fa_icon: fab fa-twitter
|
||||
url: https://twitter.com/projectvelero
|
||||
Slack:
|
||||
fa_icon: fab fa-slack
|
||||
url: https://kubernetes.slack.com/messages/velero
|
||||
Google Groups:
|
||||
fa_icon: fas fa-users
|
||||
url: https://groups.google.com/forum/#!forum/projectvelero
|
||||
RSS:
|
||||
fa_icon: fa fa-rss
|
||||
url: feed.xml
|
||||
GitHub:
|
||||
fa_icon: fab fa-github
|
||||
url: https://github.com/vmware-tanzu/velero
|
||||
|
||||
defaults:
|
||||
- scope:
|
||||
path: "" # an empty string here means all files in the project
|
||||
type: "posts"
|
||||
values:
|
||||
layout: "posts"
|
||||
- scope:
|
||||
path: ""
|
||||
type: "pages"
|
||||
values:
|
||||
layout: "default"
|
||||
- scope:
|
||||
path: docs/main
|
||||
values:
|
||||
version: main
|
||||
gh: https://github.com/vmware-tanzu/velero/tree/main
|
||||
layout: "docs"
|
||||
- scope:
|
||||
path: docs/v1.4
|
||||
values:
|
||||
version: v1.4
|
||||
gh: https://github.com/vmware-tanzu/velero/tree/v1.4.0
|
||||
layout: "docs"
|
||||
- scope:
|
||||
path: docs/v1.3.2
|
||||
values:
|
||||
version: v1.3.2
|
||||
gh: https://github.com/vmware-tanzu/velero/tree/v1.3.2
|
||||
layout: "docs"
|
||||
- scope:
|
||||
path: docs/v1.3.1
|
||||
values:
|
||||
version: v1.3.1
|
||||
gh: https://github.com/vmware-tanzu/velero/tree/v1.3.1
|
||||
layout: "docs"
|
||||
- scope:
|
||||
path: docs/v1.3.0
|
||||
values:
|
||||
version: v1.3.0
|
||||
gh: https://github.com/vmware-tanzu/velero/tree/v1.3.0
|
||||
layout: "docs"
|
||||
- scope:
|
||||
path: docs/v1.2.0
|
||||
values:
|
||||
version: v1.2.0
|
||||
gh: https://github.com/vmware-tanzu/velero/tree/v1.2.0
|
||||
layout: "docs"
|
||||
- scope:
|
||||
path: docs/v1.1.0
|
||||
values:
|
||||
version: v1.1.0
|
||||
gh: https://github.com/vmware-tanzu/velero/tree/v1.1.0
|
||||
layout: "docs"
|
||||
- scope:
|
||||
path: docs/v1.0.0
|
||||
values:
|
||||
version: v1.0.0
|
||||
gh: https:/github.com/vmware-tanzu/velero/tree/v1.0.0
|
||||
layout: "docs"
|
||||
- scope:
|
||||
path: docs/v0.11.0
|
||||
values:
|
||||
version: v0.11.0
|
||||
gh: https:/github.com/vmware-tanzu/velero/tree/v0.11.0
|
||||
layout: "docs"
|
||||
- scope:
|
||||
path: docs/v0.10.0
|
||||
values:
|
||||
version: v0.10.0
|
||||
gh: https:/github.com/vmware-tanzu/velero/tree/v0.10.0
|
||||
layout: "docs"
|
||||
- scope:
|
||||
path: docs/v0.9.0
|
||||
values:
|
||||
version: v0.9.0
|
||||
gh: https:/github.com/vmware-tanzu/velero/tree/v0.9.0
|
||||
layout: "docs"
|
||||
- scope:
|
||||
path: docs/v0.8.1
|
||||
values:
|
||||
version: v0.8.1
|
||||
gh: https:/github.com/vmware-tanzu/velero/tree/v0.8.1
|
||||
layout: "docs"
|
||||
- scope:
|
||||
path: docs/v0.8.0
|
||||
values:
|
||||
version: v0.8.0
|
||||
gh: https:/github.com/vmware-tanzu/velero/tree/v0.8.0
|
||||
layout: "docs"
|
||||
- scope:
|
||||
path: docs/v0.7.1
|
||||
values:
|
||||
version: v0.7.1
|
||||
gh: https://github.com/vmware-tanzu/velero/tree/v0.7.1
|
||||
layout: "docs"
|
||||
- scope:
|
||||
path: docs/v0.7.0
|
||||
values:
|
||||
version: v0.7.0
|
||||
gh: https://github.com/vmware-tanzu/velero/tree/v0.7.0
|
||||
layout: "docs"
|
||||
- scope:
|
||||
path: docs/v0.6.0
|
||||
values:
|
||||
version: v0.6.0
|
||||
gh: https://github.com/vmware-tanzu/velero/tree/v0.6.0
|
||||
layout: "docs"
|
||||
- scope:
|
||||
path: docs/v0.5.0
|
||||
values:
|
||||
version: v0.5.0
|
||||
gh: https://github.com/vmware-tanzu/velero/tree/v0.5.0
|
||||
layout: "docs"
|
||||
- scope:
|
||||
path: docs/v0.4.0
|
||||
values:
|
||||
version: v0.4.0
|
||||
gh: https://github.com/vmware-tanzu/velero/tree/v0.4.0
|
||||
layout: "docs"
|
||||
- scope:
|
||||
path: docs/v0.3.0
|
||||
values:
|
||||
version: v0.3.0
|
||||
gh: https://github.com/vmware-tanzu/velero/tree/v0.3.0
|
||||
layout: "docs"
|
||||
|
||||
page_gen:
|
||||
- data: shortlinks
|
||||
template: redirect
|
||||
name: key
|
||||
dir: docs
|
||||
|
||||
collections:
|
||||
- contributors
|
||||
- casestudies
|
||||
- plugin-list
|
||||
|
||||
versioning: true
|
||||
latest: v1.4
|
||||
versions:
|
||||
- main
|
||||
- v1.4
|
||||
- v1.3.2
|
||||
- v1.3.1
|
||||
- v1.3.0
|
||||
- v1.2.0
|
||||
- v1.1.0
|
||||
- v1.0.0
|
||||
- v0.11.0
|
||||
- v0.10.0
|
||||
- v0.9.0
|
||||
- v0.8.1
|
||||
- v0.8.0
|
||||
- v0.7.1
|
||||
- v0.7.0
|
||||
- v0.6.0
|
||||
- v0.5.0
|
||||
- v0.4.0
|
||||
- v0.3.0
|
||||
|
||||
# Build settings
|
||||
permalink: /blog/:title/
|
||||
sass:
|
||||
sass_dir: css
|
||||
style: :compressed
|
||||
|
||||
# Use the following plug-ins
|
||||
plugins:
|
||||
- jekyll-readme-index # use README.md as index.html
|
||||
- jekyll-sitemap # Create a sitemap using the official Jekyll sitemap gem
|
||||
- jekyll-feed # Create an Atom feed using the official Jekyll feed gem
|
||||
- jekyll-relative-links # Used to auto generate md links to html links
|
||||
- jekyll-optional-front-matter # Parse Markdown files that do not have front-matter callouts
|
||||
- jekyll-titles-from-headings # pull the page title from the first Markdown heading when none is specified.
|
||||
- jekyll-paginate # pagination object for collections (e.g. posts)
|
||||
- jekyll-redirect-from
|
||||
- jekyll-seo-tag
|
||||
- jemoji
|
||||
|
||||
# Include these subdirectories
|
||||
include:
|
||||
- CONTRIBUTING.md
|
||||
- README.md
|
||||
|
||||
# Exclude these files from your production _site
|
||||
exclude:
|
||||
- Gemfile
|
||||
- Gemfile.lock
|
||||
- README-JEKYLL.md
|
||||
- LICENSE
|
||||
- CNAME
|
||||
- Runbook.docx
|
||||
- '*.sh'
|
|
@ -1,48 +0,0 @@
|
|||
toc:
|
||||
- title: Introduction
|
||||
subfolderitems:
|
||||
- page: About Ark
|
||||
url: /index.html
|
||||
- page: Getting started
|
||||
url: /quickstart
|
||||
- page: How Ark works
|
||||
url: /about
|
||||
- title: Run Ark
|
||||
subfolderitems:
|
||||
- page: Create a backup
|
||||
url: /run-backup
|
||||
- page: Restore from backup
|
||||
url: /restore
|
||||
- title: Customize Ark
|
||||
subfolderitems:
|
||||
- page: Build from source
|
||||
url: /build-from-scratch
|
||||
- page: Extend
|
||||
url: /extend
|
||||
- page: Extend with plugins
|
||||
url: /plugins
|
||||
- page: Extend with hooks
|
||||
url: /hooks
|
||||
- title: Reference
|
||||
subfolderitems:
|
||||
- page: Backup file format
|
||||
url: /output-file-format
|
||||
- page: API types
|
||||
url: /api-types
|
||||
- title: Tutorials
|
||||
subfolderitems:
|
||||
- page: Disaster Recovery
|
||||
url: /use-cases
|
||||
- page: Cluster migration
|
||||
url: /use-cases.html#cluster-migration
|
||||
- title: Troubleshooting
|
||||
subfolderitems:
|
||||
- page: Troubleshooting
|
||||
url: /troubleshooting
|
||||
- page: Troubleshoot an install or setup
|
||||
url: /debugging-install
|
||||
- page: Troubleshoot a backup delete
|
||||
url: /debugging-deletes
|
||||
- page: Troubleshoot a restore
|
||||
url: /debugging-restores
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
- title: Troubleshooting
|
||||
key: troubleshooting
|
||||
destination: troubleshooting
|
||||
- title: Supported Providers
|
||||
key: supported-providers
|
||||
destination: supported-providers
|
||||
- title: ZenHub
|
||||
key: zenhub
|
||||
destination: zenhub
|
||||
- title: Install Overview
|
||||
key: install-overview
|
||||
destination: basic-install
|
||||
- title: Start Contributing
|
||||
key: start-contributing
|
||||
destination: start-contributing
|
||||
- title: Customize Installation
|
||||
key: customize-installation
|
||||
destination: customize-installation
|
||||
- title: Frequently Asked Questions
|
||||
key: faq
|
||||
destination: faq
|
||||
- title: Container Storage Interface Snapshot Support in Velero
|
||||
key: csi
|
||||
destination: csi
|
|
@ -1,13 +0,0 @@
|
|||
<div class="row">
|
||||
{% for post in site.tags[page.tag] %}
|
||||
{% include blog-post-card.html %}
|
||||
{% if limit > 0 and forloop.index >= limit %}
|
||||
{% break %}
|
||||
{% endif %}
|
||||
{% assign row = forloop.index | modulo: 3 %}
|
||||
{% if row == 0 %}
|
||||
</div>
|
||||
<div class="row mt-4">
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
|
@ -1,13 +0,0 @@
|
|||
<div class="row">
|
||||
{% for post in site.posts %}
|
||||
{% include blog-post-card.html %}
|
||||
{% if limit > 0 and forloop.index >= limit %}
|
||||
{% break %}
|
||||
{% endif %}
|
||||
{% assign row = forloop.index | modulo: 3 %}
|
||||
{% if row == 0 %}
|
||||
</div>
|
||||
<div class="row mt-4">
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
|
@ -1,26 +0,0 @@
|
|||
{{casestudy_background}}
|
||||
<div class="alternating-cards">
|
||||
{% for casestudy in site.casestudies %}
|
||||
<div class="row no-gutters align-items-center">
|
||||
{% if casestudy.icon %}
|
||||
<div class="order-xs-first col-md-3 match-height icon bg-color-{{ page.backgrounds.case_study }} {% cycle('order-md-first', 'order-md-last') %}">
|
||||
<img src="/img/case-study-icons/{{ casestudy.icon }}" alt="{{ casestudy.title }}"/>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="order-xs-last col-md-9 {% cycle('order-md-last', 'order-md-first') %}">
|
||||
<div class="card-body">
|
||||
{% if casestudy.title != blank %}
|
||||
<h5 class="card-title">{{ casestudy.title }}</h5>
|
||||
{% endif %}
|
||||
<p class="card-text">{{ casestudy.content | markdownify }}</p>
|
||||
{% for link in casestudy.links %}
|
||||
<a class="card-link btn btn-primary btn-sm" href="{{ link[1] }}">{{ link[0] }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if limit > 0 and forloop.index >= limit %}
|
||||
{% break %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
|
@ -1,21 +0,0 @@
|
|||
<div class="row">
|
||||
{% for casestudy in site.casestudies %}
|
||||
<div class="card card-dark col-md-12 mb-3 mb-sm-0 {% if forloop.index > 1 %}mt-3{% endif %}">
|
||||
<div class="card-body match-height text-center">
|
||||
{% if casestudy.title != blank %}
|
||||
<h5 class="card-title">{{ casestudy.title }}</h5>
|
||||
{% endif %}
|
||||
{% if casestudy.subtitle != blank %}
|
||||
<h6 class="card-subtitle mb-2">{{ casestudy.subtitle }}</h6>
|
||||
{% endif %}
|
||||
<p class="card-text">{{ casestudy.content | markdownify }}</p>
|
||||
{% for link in casestudy.links %}
|
||||
<a class="card-link btn btn-primary" href="{{ link[1] }}">{{ link[0] }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% if limit > 0 and forloop.index >= limit %}
|
||||
{% break %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
|
@ -1,26 +0,0 @@
|
|||
<div class="row">
|
||||
<div class="col">
|
||||
<h2 class="mb-2">The {{ site.title }} Team</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p>{{ site.title }} is released as open source software and provides community support through our GitHub project page.
|
||||
If you encounter an issue or have a question, feel free to reach out on the <strong><a href="{{ site.gh_repo }}/issues" class="light">GitHub issues page for {{ site.title }}</a></strong>.</p>
|
||||
<p>The Velero project team welcomes contributions from the community, please see our <strong><a href="https://velero.io/docs/main/start-contributing/" class="light">contributing documentation</a></strong>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row thumbnail-grid mt-5">
|
||||
{% for person in site.contributors %}
|
||||
<div class="col-xs-12 col-sm-6 col-md-4">
|
||||
<div class="media thumbnail-item">
|
||||
<img src="{{ person.image }}" class="rounded-circle" alt="Person" />
|
||||
<div class="media-body align-self-center">
|
||||
<h6><a href="https://github.com/{{ person.github_handle }}">{{ person.first_name }} {{ person.last_name }}</a></h6>
|
||||
{{ person.content | markdownify }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
|
@ -1,52 +0,0 @@
|
|||
<div class="section section-background-darkest-blue">
|
||||
<div class="section-content">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-6 col-lg-8">
|
||||
<h5>{{ site.footer.title }}</h5>
|
||||
<p>{{ site.footer.content }}</p>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-6 col-lg-3 offset-lg-1">
|
||||
<p><strong>{{ site.footer.cta_title }}</strong></p>
|
||||
<a href="{{ site.footer.cta_url }}" class="btn btn-sm btn-primary btn-no-border">{{ site.footer.cta_text }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="section site-footer">
|
||||
<div class="section-content">
|
||||
<div class="row justify-content-between align-items-center">
|
||||
<div class="col-12 col-md-8 mb-3 mb-md-0">
|
||||
<ul class="social-links text-center text-md-left">
|
||||
{% for link in site.footer_social_links %}
|
||||
<li>
|
||||
{% if(link[1].fa_icon != false) %}
|
||||
<i class="{{ link[1].fa_icon }} fa-lg fa-fw mr-1"></i>
|
||||
{% endif %}
|
||||
<a href="{{ link[1].url }}">{{ link[0] }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-12 col-md-4 text-center text-md-right">
|
||||
<a href="/" aria-label="Velero homepage"><img src="/img/{{ site.logo }}" class="logo" alt="Homepage"/></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-center">
|
||||
<div class="col copyright text-center text-md-right mt-4">
|
||||
© {{ site.time | date: '%Y' }} {{ site.author }}.
|
||||
<a href="{{ site.footer.vm-link }}" class="vm-logo">A VMware-backed project. <img src="/img/{{ site.vm_logo }}" alt="VMware logo"/></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<!-- JS -->
|
||||
<script defer src="https://use.fontawesome.com/releases/v5.8.1/js/all.js" integrity="sha384-g5uSoOSBd7KkhAMlnQILrecXvzst9TdC09/VM+pjDTCM+1il8RHz5fKANTFFb+gQ" crossorigin="anonymous"></script>
|
||||
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
|
||||
crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
|
||||
crossorigin="anonymous"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" crossorigin="anonymous"></script>
|
||||
|
||||
<script src="/js/jquery.matchHeight.js?{{site.time | date: '%s%N'}}"></script>
|
||||
<script src="/js/scripts.js?{{site.time | date: '%s%N'}}"></script>
|
|
@ -1,9 +0,0 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
|
||||
<link rel="icon" href="/favicon.ico" type="image/x-icon">
|
||||
<link rel="stylesheet" href="/css/styles.css?{{site.time | date: '%s%N'}}">
|
||||
{% seo %}
|
||||
</head>
|
|
@ -1,10 +0,0 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
|
||||
<link rel="icon" href="/favicon.ico" type="image/x-icon">
|
||||
<link rel="stylesheet" href="/css/styles.css?{{site.time | date: '%s%N'}}">
|
||||
<title>{{ site.title }} {{page.title}}</title>
|
||||
{% seo %}
|
||||
</head>
|
|
@ -1,24 +0,0 @@
|
|||
<nav class="navigation">
|
||||
<!-- If new pages are added to the site and the TOC needs to be updated, it
|
||||
can be overridden, using toc-mapping.yml -->
|
||||
{% assign tocTemplateName = site.data.toc-mapping[page.version] %}
|
||||
{% if tocTemplateName == null %}
|
||||
{% assign tocTemplateName = 'default' %}
|
||||
{% endif %}
|
||||
{% assign toc = site.data[tocTemplateName].toc %}
|
||||
|
||||
{% for item in toc %}
|
||||
<h3>{{ item.title }}</h3>
|
||||
<ul>
|
||||
{% for entry in item.subfolderitems %}
|
||||
<li>
|
||||
{% if entry.github %}
|
||||
<a href="{{ entry.url | prepend: page.gh }}" target="_blank">{{ entry.page }}</a>
|
||||
{% else %}
|
||||
<a href="{{ entry.url | prepend: page.version | prepend: "/docs/" | relative_url }}">{{ entry.page }}</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endfor %}
|
||||
</nav>
|
|
@ -1,81 +0,0 @@
|
|||
<div class="section section-card section-card-offset-top promo-cards">
|
||||
<div class="section-content">
|
||||
<div class="row">
|
||||
{% for plugin in site.plugin-list %}
|
||||
<div class="col-md">
|
||||
<div class="card card-light mb-3 mb-md-0 shadow-sm">
|
||||
<div class="card-body match-height">
|
||||
{% if plugin.supported-by-velero-team == "true" %}
|
||||
{% if plugin.link.size > 0 %}
|
||||
<h5><a href="{{ plugin.link }}" class="dark">{{ plugin.title }}</a></h5>
|
||||
{% else %}
|
||||
<h5>{{ plugin.title }}</h5>
|
||||
{% endif %}
|
||||
<p>{{ plugin.content }}</p>
|
||||
{% if plugin.object-storage %}
|
||||
<img src="https://img.shields.io/badge/Object Storage-supported-green">
|
||||
{% endif %}
|
||||
{% if plugin.volumesnapshotter %}
|
||||
<img src="https://img.shields.io/badge/VolumeSnapshotter-supported-green">
|
||||
{% endif %}
|
||||
{% if plugin.local-storage %}
|
||||
<img src="https://img.shields.io/badge/Local Storage-supported-green">
|
||||
{% endif %}
|
||||
{% if plugin.supported-by-velero-team %}
|
||||
<img src="https://img.shields.io/badge/Supported%20By-Velero%20team-blue">
|
||||
{% endif %}
|
||||
{% if plugin.BackupItemAction %}
|
||||
<img src="https://img.shields.io/badge/BackupItemAction-supported-green">
|
||||
{% endif %}
|
||||
{% if plugin.RestoreItemAction %}
|
||||
<img src="https://img.shields.io/badge/RestoreItemAction-supported-green">
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="card card-light mb-3 mb-md-0 shadow-sm">
|
||||
<div class="card-body match-height">
|
||||
{% if plugin.supported-by-velero-team != "true" && plugin.prototype != "true" %}
|
||||
{% if plugin.link.size > 0 %}
|
||||
<h5><a href="{{ plugin.link }}" class="dark">{{ plugin.title }}</a></h5>
|
||||
{% else %}
|
||||
<h5>{{ plugin.title }}</h5>
|
||||
{% endif %}
|
||||
<p>{{ plugin.content }}</p>
|
||||
{% if plugin.object-storage %}
|
||||
<img src="https://img.shields.io/badge/Object Storage-supported-green">
|
||||
{% endif %}
|
||||
{% if plugin.volumesnapshotter %}
|
||||
<img src="https://img.shields.io/badge/VolumeSnapshotter-supported-green">
|
||||
{% endif %}
|
||||
{% if plugin.local-storage %}
|
||||
<img src="https://img.shields.io/badge/Local Storage-supported-green">
|
||||
{% endif %}
|
||||
{% if plugin.supported-by-velero-team %}
|
||||
<img src="https://img.shields.io/badge/Supported%20By-Velero%20team-blue">
|
||||
{% endif %}
|
||||
{% if plugin.BackupItemAction %}
|
||||
<img src="https://img.shields.io/badge/BackupItemAction-supported-green">
|
||||
{% endif %}
|
||||
{% if plugin.RestoreItemAction %}
|
||||
<img src="https://img.shields.io/badge/RestoreItemAction-supported-green">
|
||||
{% endif %}
|
||||
{% if plugin.beta %}
|
||||
<img src="https://img.shields.io/badge/Beta-true-yellow">
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if limit > 0 and forloop.index >= limit %}
|
||||
{% break %}
|
||||
{% endif %}
|
||||
{% assign row = forloop.index | modulo: 3 %}
|
||||
{% if row == 0 %}
|
||||
</div>
|
||||
<div class="row mt-4">
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,10 +0,0 @@
|
|||
<h5 class="font-color-darker">Related Content</h5>
|
||||
<div class="row">
|
||||
{% for category in site.categories limit:1 %}
|
||||
|
||||
{% for post in category[1] limit:2 %}
|
||||
{% include blog-post-card.html %}
|
||||
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</div>
|
|
@ -1,26 +0,0 @@
|
|||
{% if page.version != site.latest %}
|
||||
<div class="alert alert-primary" role="alert">
|
||||
{% if page.version == 'main' %}
|
||||
<p>
|
||||
<i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
|
||||
This is the documentation for the latest development version of Velero. Both code and docs may be
|
||||
unstable, and these docs are not guaranteed to be up to date or correct. See the
|
||||
<a href="{{latest_url}}">latest version</a>.
|
||||
</p>
|
||||
{% elsif page.version contains 'beta' or page.version contains 'alpha' or page.version contains 'rc' or page.version contains 'pre' %}
|
||||
<p>
|
||||
<i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
|
||||
This is the documentation for the latest pre-production version of Velero. Both code and docs may be
|
||||
unstable, and these docs only a best-guess effort at being up to date or correct. See the
|
||||
<a href="{{latest_url}}">latest version</a>.
|
||||
</p>
|
||||
{% else %}
|
||||
<p>
|
||||
<i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
|
||||
Documentation for version {{ page.version }} is no longer actively maintained.
|
||||
The version you are currently viewing is a static snapshot.
|
||||
For up-to-date documentation, see the <a href="{{latest_url}}">latest version</a>.
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
|
@ -1,21 +0,0 @@
|
|||
<div class="row">
|
||||
<div class="dropdown mb-2">
|
||||
{% if site.versioning %}
|
||||
<button class="btn btn-primary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{{ page.version }}
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
{% assign original_version = page.version | prepend: '/' | append: '/' %}
|
||||
{% assign latest_url = page.url | replace: page.version, site.latest | relative_url %}
|
||||
|
||||
|
||||
{% for version in site.versions %}
|
||||
{% assign new_version = version | prepend: '/' | append: '/' %}
|
||||
<a class="dropdown-item" href="{{ page.url | replace: original_version, new_version | relative_url }}">{{ version }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<span>{{ site.latest }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
|
@ -1,15 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
{% include head.html %}
|
||||
|
||||
<body id="{{ page.id }}">
|
||||
<div class="container-fluid site-outer-container">
|
||||
<div class="site-container">
|
||||
{% include site-header.html %}
|
||||
{{ content }}
|
||||
{% include footer.html %}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,62 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
{% include head-docs.html %}
|
||||
{% if page.version != "main" %}
|
||||
<!-- Block google from indexing versioned docs -->
|
||||
<meta name="robots" content="noindex">
|
||||
{% endif %}
|
||||
{% if page.name != "README.md" %}
|
||||
<title>{{ site.title }} Docs - {{page.title}}</title>
|
||||
{% endif %}
|
||||
{% if page.name == "README.md" %}
|
||||
<title>{{ site.title }} Docs - Overview</title>
|
||||
{% endif %}
|
||||
|
||||
<body id="docs">
|
||||
<div class="container-fluid site-outer-container">
|
||||
<div class="site-container">
|
||||
{% include site-header.html %}
|
||||
<div class="post-single-hero post-single-hero-short bg-color-{{ site.hero.background-color }}">
|
||||
<div class="section">
|
||||
<div class="section-content">
|
||||
<h1>Documentation</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section section-card pt-4 pb-0">
|
||||
<div class="container container-max">
|
||||
<div class="row">
|
||||
<div class="col-md-3 toc">
|
||||
{% include versions.html %}
|
||||
<br />
|
||||
<form class="d-flex align-items-center">
|
||||
<span class="algolia-autocomplete" style="position: relative; display: inline-block; direction: ltr;">
|
||||
<input type="search" class="form-control docsearch-input" id="search-input" placeholder="Search..." aria-label="Search for..." autocomplete="off" spellcheck="false" role="combobox" aria-autocomplete="list" aria-expanded="false" aria-owns="algolia-autocomplete-listbox-0" dir="auto" style="position: relative; vertical-align: top;">
|
||||
</span>
|
||||
</form>
|
||||
{% include nav.html %}
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
{% include version-warning.html %}
|
||||
<div class="documentation-container">
|
||||
{{ content }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% include footer.html %}
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
|
||||
<script type="text/javascript"> docsearch({
|
||||
apiKey: '3d80f66bb5ecf85f8e2760caef383f24',
|
||||
indexName: 'velero',
|
||||
inputSelector: '.docsearch-input',
|
||||
algoliaOptions: { 'facetFilters': ["version:{{ page.version }}"] },
|
||||
debug: false // Set debug to true if you want to inspect the dropdown
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,28 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
{% include head.html %}
|
||||
|
||||
<body id="{{ page.id }}">
|
||||
<div class="container-fluid site-outer-container">
|
||||
<div class="site-container">
|
||||
{% include site-header.html %}
|
||||
<div class="post-single-hero bg-color-{{ site.hero.background-color }}">
|
||||
<div class="section">
|
||||
<div class="section-content">
|
||||
<h1>{{ page.title }}</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="post-single-body">
|
||||
<div class="section section-card">
|
||||
<div class="section-content pt-4 pb-0">
|
||||
{{ content }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% include footer.html %}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,55 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
{% include head.html %}
|
||||
|
||||
<body id="blog">
|
||||
<div class="container-fluid site-outer-container">
|
||||
<div class="site-container">
|
||||
{% include site-header.html %}
|
||||
<div class="post-single-hero bg-color-{{ site.hero.background-color }}">
|
||||
<div class="section">
|
||||
<div class="section-content">
|
||||
<h1>{{ page.title }}</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="post-single-body">
|
||||
<div class="section section-card">
|
||||
<div class="section-content pt-4 pb-0">
|
||||
<div class="post-single-meta">
|
||||
<div class="post-single-meta-author">
|
||||
{% if page.author_avatar %}
|
||||
<div class="post-single-meta-author-avatar">
|
||||
<img src="{{ page.author_avatar }}" alt="{{ page.author_name }}">
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="post-single-meta-author-name">
|
||||
<a href="/tags/{{ page.author_name | urlencode }}">{{ page.author_name }}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="post-single-meta-date">
|
||||
{{ page.date | date: "%B %d, %Y" }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="post-single-content">
|
||||
{{ content }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section pt-3">
|
||||
<div class="section-content section-content-thin">
|
||||
{% include related-posts.html %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include footer.html %}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,15 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
{% if page.dir contains "/docs/" %}
|
||||
<meta http-equiv="refresh" content="0; url=/docs/{{ site.latest }}/{{ page.destination }}" />
|
||||
<script type="text/javascript">
|
||||
window.location.href = "/docs/{{ site.latest }}/{{ page.destination }}"
|
||||
</script>
|
||||
<title>Redirecting to docs...</title>
|
||||
</head>
|
||||
<body>
|
||||
Redirecting to {{ page.destination }}. If it doesn't load, click <a href="/docs/{{ site.latest }}/{{ page.destination }}" />here</a>.
|
||||
</body>
|
||||
</html>
|
||||
{% endif %}
|
|
@ -1,20 +0,0 @@
|
|||
---
|
||||
layout: default
|
||||
type: standard
|
||||
caption: 'Tag Index'
|
||||
id: blog
|
||||
---
|
||||
<div class="post-single-hero bg-color-{{ site.hero.background-color }}">
|
||||
<div class="section">
|
||||
<div class="section-content">
|
||||
<h1>{{ page.title }}</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="post-single-body">
|
||||
<div class="section section-card">
|
||||
<div class="section-content pt-4 pb-0">
|
||||
{% include blog-posts-tag.html %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,135 +0,0 @@
|
|||
# coding: utf-8
|
||||
# Generate pages from individual records in yml files
|
||||
# (c) 2014-2016 Adolfo Villafiorita
|
||||
# Distributed under the conditions of the MIT License
|
||||
|
||||
module Jekyll
|
||||
|
||||
module Sanitizer
|
||||
# strip characters and whitespace to create valid filenames, also lowercase
|
||||
def sanitize_filename(name)
|
||||
if(name.is_a? Integer)
|
||||
return name.to_s
|
||||
end
|
||||
return name.tr(
|
||||
"ÀÁÂÃÄÅàáâãäåĀāĂ㥹ÇçĆćĈĉĊċČčÐðĎďĐđÈÉÊËèéêëĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħÌÍÎÏìíîïĨĩĪīĬĭĮįİıĴĵĶķĸĹĺĻļĽľĿŀŁłÑñŃńŅņŇňʼnŊŋÑñÒÓÔÕÖØòóôõöøŌōŎŏŐőŔŕŖŗŘřŚśŜŝŞşŠšſŢţŤťŦŧÙÚÛÜùúûüŨũŪūŬŭŮůŰűŲųŴŵÝýÿŶŷŸŹźŻżŽž",
|
||||
"AAAAAAaaaaaaAaAaAaCcCcCcCcCcDdDdDdEEEEeeeeEeEeEeEeEeGgGgGgGgHhHhIIIIiiiiIiIiIiIiIiJjKkkLlLlLlLlLlNnNnNnNnnNnNnOOOOOOooooooOoOoOoRrRrRrSsSsSsSssTtTtTtUUUUuuuuUuUuUuUuUuUuWwYyyYyYZzZzZz"
|
||||
).downcase.strip.gsub(' ', '-').gsub(/[^\w.-]/, '')
|
||||
end
|
||||
end
|
||||
|
||||
# this class is used to tell Jekyll to generate a page
|
||||
class DataPage < Page
|
||||
include Sanitizer
|
||||
|
||||
# - site and base are copied from other plugins: to be honest, I am not sure what they do
|
||||
#
|
||||
# - `index_files` specifies if we want to generate named folders (true) or not (false)
|
||||
# - `dir` is the default output directory
|
||||
# - `data` is the data defined in `_data.yml` of the record for which we are generating a page
|
||||
# - `name` is the key in `data` which determines the output filename
|
||||
# - `template` is the name of the template for generating the page
|
||||
# - `extension` is the extension for the generated file
|
||||
def initialize(site, base, index_files, dir, data, name, template, extension)
|
||||
@site = site
|
||||
@base = base
|
||||
|
||||
# @dir is the directory where we want to output the page
|
||||
# @name is the name of the page to generate
|
||||
#
|
||||
# the value of these variables changes according to whether we
|
||||
# want to generate named folders or not
|
||||
if data[name] == nil
|
||||
puts "error (datapage_gen). empty value for field '#{name}' in record #{data}"
|
||||
else
|
||||
filename = sanitize_filename(data[name]).to_s
|
||||
|
||||
@dir = dir + (index_files ? "/" + filename + "/" : "")
|
||||
@name = (index_files ? "index" : filename) + "." + extension.to_s
|
||||
|
||||
self.process(@name)
|
||||
self.read_yaml(File.join(base, '_layouts'), template + ".html")
|
||||
self.data['title'] = data[name]
|
||||
# add all the information defined in _data for the current record to the
|
||||
# current page (so that we can access it with liquid tags)
|
||||
self.data.merge!(data)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class DataPagesGenerator < Generator
|
||||
safe true
|
||||
|
||||
# generate loops over _config.yml/page_gen invoking the DataPage
|
||||
# constructor for each record for which we want to generate a page
|
||||
|
||||
def generate(site)
|
||||
# page_gen_dirs determines whether we want to generate index pages
|
||||
# (name/index.html) or standard files (name.html). This information
|
||||
# is passed to the DataPage constructor, which sets the @dir variable
|
||||
# as required by this directive
|
||||
index_files = site.config['page_gen-dirs'] == true
|
||||
|
||||
# data contains the specification of the data for which we want to generate
|
||||
# the pages (look at the README file for its specification)
|
||||
data = site.config['page_gen']
|
||||
if data
|
||||
data.each do |data_spec|
|
||||
index_files_for_this_data = data_spec['index_files'] != nil ? data_spec['index_files'] : index_files
|
||||
template = data_spec['template'] || data_spec['data']
|
||||
name = data_spec['name']
|
||||
dir = data_spec['dir'] || data_spec['data']
|
||||
extension = data_spec['extension'] || "html"
|
||||
|
||||
if site.layouts.key? template
|
||||
# records is the list of records defined in _data.yml
|
||||
# for which we want to generate different pages
|
||||
records = nil
|
||||
data_spec['data'].split('.').each do |level|
|
||||
if records.nil?
|
||||
records = site.data[level]
|
||||
else
|
||||
records = records[level]
|
||||
end
|
||||
end
|
||||
|
||||
# apply filtering conditions:
|
||||
# - filter requires the name of a boolean field
|
||||
# - filter_condition evals a ruby expression
|
||||
records = records.select { |r| r[data_spec['filter']] } if data_spec['filter']
|
||||
records = records.select { |record| eval(data_spec['filter_condition']) } if data_spec['filter_condition']
|
||||
|
||||
records.each do |record|
|
||||
site.pages << DataPage.new(site, site.source, index_files_for_this_data, dir, record, name, template, extension)
|
||||
end
|
||||
else
|
||||
puts "error (datapage_gen). could not find template #{template}" if not site.layouts.key? template
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module DataPageLinkGenerator
|
||||
include Sanitizer
|
||||
|
||||
# use it like this: {{input | datapage_url: dir}}
|
||||
# to generate a link to a data_page.
|
||||
#
|
||||
# the filter is smart enough to generate different link styles
|
||||
# according to the data_page-dirs directive ...
|
||||
#
|
||||
# ... however, the filter is not smart enough to support different
|
||||
# extensions for filenames.
|
||||
#
|
||||
# Thus, if you use the `extension` feature of this plugin, you
|
||||
# need to generate the links by hand
|
||||
def datapage_url(input, dir)
|
||||
extension = Jekyll.configuration({})['page_gen-dirs'] ? '/' : '.html'
|
||||
"#{dir}/#{sanitize_filename(input)}#{extension}"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Liquid::Template.register_filter(Jekyll::DataPageLinkGenerator)
|
|
@ -1,32 +0,0 @@
|
|||
module Jekyll
|
||||
|
||||
class TagPage < Page
|
||||
def initialize(site, base, dir, tag)
|
||||
@site = site
|
||||
@base = base
|
||||
@dir = dir
|
||||
@name = 'index.html'
|
||||
|
||||
self.process(@name)
|
||||
self.read_yaml(File.join(base, '_layouts'), 'tag-index.html')
|
||||
self.data['tag'] = tag
|
||||
|
||||
tag_title_prefix = site.config['tag_title_prefix'] || 'Posts by '
|
||||
self.data['title'] = "#{tag_title_prefix}#{tag}"
|
||||
end
|
||||
end
|
||||
|
||||
class TagPageGenerator < Generator
|
||||
safe true
|
||||
|
||||
def generate(site)
|
||||
if site.layouts.key? 'tag-index'
|
||||
dir = site.config['tag_dir'] || 'tags'
|
||||
site.tags.keys.each do |tag|
|
||||
site.pages << TagPage.new(site, site.source, File.join(dir, tag), tag)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -1,123 +0,0 @@
|
|||
# Title: YouTube plugin for Jekyll
|
||||
# Description: Liquid tag to generate a YouTube embed.
|
||||
# Authors:
|
||||
# - Joey Hoer (@joeyhoer | https://joeyhoer.com)
|
||||
#
|
||||
# Link: https://developers.google.com/youtube/player_parameters#Parameters
|
||||
#
|
||||
# Syntax: {% youtube [video_id] [width] [height] [query_param:value]... %}
|
||||
#
|
||||
# Examples:
|
||||
# {% youtube dQw4w9WgXcQ %}
|
||||
# {% youtube dQw4w9WgXcQ 600 rel:0 modestbranding:1 %}
|
||||
#
|
||||
|
||||
module Jekyll
|
||||
class YouTube < Liquid::Tag
|
||||
|
||||
## Constants
|
||||
|
||||
@@ATTRIBUTES = %w(
|
||||
autoplay
|
||||
cc_load_policy
|
||||
color
|
||||
controls
|
||||
disablekb
|
||||
enablejsapi
|
||||
end
|
||||
fs
|
||||
hl
|
||||
iv_load_policy
|
||||
list
|
||||
listType
|
||||
loop
|
||||
modestbranding
|
||||
origin
|
||||
playlist
|
||||
playsinline
|
||||
rel
|
||||
showinfo
|
||||
start
|
||||
widget_referrer
|
||||
)
|
||||
|
||||
@ytid = nil
|
||||
@width = ''
|
||||
@height = ''
|
||||
|
||||
def initialize(tag_name, markup, tokens)
|
||||
@content=markup
|
||||
|
||||
@config = {}
|
||||
|
||||
# Override configuration with values defined within _config.yml
|
||||
if Jekyll.configuration({}).has_key?('youtube')
|
||||
config = Jekyll.configuration({})['youtube']
|
||||
override_config(config)
|
||||
end
|
||||
|
||||
params = markup.split
|
||||
|
||||
if params.shift =~ /(?:(?:https?:\/\/)?(?:www.)?(?:youtube.com\/(?:embed\/|watch\?v=)|youtu.be\/)?(\S+)(?:\?rel=\d)?)/i
|
||||
@video_id = $1
|
||||
end
|
||||
|
||||
@width = (params[0].to_i > 0) ? params.shift.to_i : 560
|
||||
@height = (params[0].to_i > 0) ? params.shift.to_i : (@width / 16.0 * 9).ceil
|
||||
|
||||
if params.size > 0
|
||||
# Override configuration with parameters defined within Liquid tag
|
||||
config = {} # Reset local config
|
||||
params.each do |param|
|
||||
param = param.gsub /\s+/, '' # Remove whitespaces
|
||||
key, value = param.split(':',2) # Split first occurrence of ':' only
|
||||
config["#{key}"] = value
|
||||
end
|
||||
override_config(config)
|
||||
end
|
||||
|
||||
super
|
||||
end
|
||||
|
||||
def override_config(config)
|
||||
config.each{ |key,value| @config[key] = value }
|
||||
end
|
||||
|
||||
def render(context)
|
||||
ouptut = super
|
||||
|
||||
if !@video_id
|
||||
@video_id = "#{context[@content.strip]}"
|
||||
end
|
||||
|
||||
if @video_id
|
||||
template_path = File.join(Dir.pwd, "_includes", "youtube.html")
|
||||
if File.exist?(template_path)
|
||||
site = context.registers[:site]
|
||||
|
||||
partial = File.read(template_path)
|
||||
template = Liquid::Template.parse(partial)
|
||||
|
||||
template.render!(({"video_id" => @video_id, "width" => @width, "height" => @height, "query_string" => render_query_string()}).merge(site.site_payload))
|
||||
else
|
||||
"<iframe width=\"#{@width}\" height=\"#{@height}\" src=\"https://www.youtube.com/embed/#{@video_id}#{render_query_string()}\" frameborder=\"0\" allowfullscreen></iframe>"
|
||||
end
|
||||
else
|
||||
puts "YouTube Embed: Error processing input, expected syntax {% youtube video_id [width] [height] [data-attr:value] %}"
|
||||
end
|
||||
end
|
||||
|
||||
def render_query_string
|
||||
result = []
|
||||
@config.each do |key,value|
|
||||
if @@ATTRIBUTES.include?(key.to_s)
|
||||
result << "#{key}=#{value}"
|
||||
end
|
||||
end
|
||||
return (!(result.empty?) ? '?' : '') + result.join('&')
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Liquid::Template.register_tag('youtube', Jekyll::YouTube)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue