From 2519330bde16901c5380add6263be5aab3476767 Mon Sep 17 00:00:00 2001
From: lucperkins
Date: Sat, 30 Mar 2019 18:53:23 -0700
Subject: [PATCH 1/3] Rework versioning system
Signed-off-by: lucperkins
---
docs/.gitignore | 2 +-
docs/Makefile | 19 +++++++++++-----
docs/config.toml | 23 -------------------
docs/generated/docs/.gitkeep | 0
docs/layouts/partials/home/banner.html | 31 +++++++++++++++++---------
docs/scripts/load-docs.sh | 6 +++--
6 files changed, 40 insertions(+), 41 deletions(-)
create mode 100644 docs/generated/docs/.gitkeep
diff --git a/docs/.gitignore b/docs/.gitignore
index 01d466af6f..b4f728858f 100644
--- a/docs/.gitignore
+++ b/docs/.gitignore
@@ -3,7 +3,7 @@ public/
resources/
# Documentation versions
-content/docs/v*
+generated/docs/v*
data/releases.yaml
# Node.js assets
diff --git a/docs/Makefile b/docs/Makefile
index 4df0d381ac..7a3a1fe19b 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -1,20 +1,29 @@
+clean:
+ rm -rf public
+
load-docs:
scripts/load-docs.sh
setup:
npm install
-serve: load-docs
+serve: clean load-docs
hugo server \
--buildDrafts \
- --buildFuture
+ --buildFuture \
+ --contentDir generated
-production-build: load-docs
- hugo --minify
+production-build: clean load-docs
+ hugo \
+ --contentDir generated \
+ --ignoreCache \
+ --minify
-preview-build: load-docs
+preview-build: clean load-docs
hugo \
--baseURL $(DEPLOY_PRIME_URL) \
--buildDrafts \
--buildFuture \
+ --contentDir generated \
+ --ignoreCache \
--minify
diff --git a/docs/config.toml b/docs/config.toml
index a764f72b29..1e02f09702 100644
--- a/docs/config.toml
+++ b/docs/config.toml
@@ -23,30 +23,7 @@ github = "https://github.com/open-policy-agent/opa"
sidebar = "/img/logos/opa-stacked-color.png"
navbar = "/img/logos/opa-icon-white.png"
-[[params.home.buttons]]
-url = "/docs/get-started"
-title = "Get started"
-
-[[params.home.buttons]]
-url = "/docs"
-title = "Learn more"
-
[menu]
-[[menu.main]]
-name = "Documentation"
-url = "/docs"
-weight = 1
-
-[[menu.main]]
-name = "Tutorials"
-url = "/docs/get-started"
-weight = 2
-
-[[menu.main]]
-name = "Playground"
-url = "https://play.openpolicyagent.org"
-weight = 3
-
[[menu.social]]
name = "Medium"
url = "https://twitter.com/openpolicyagent"
diff --git a/docs/generated/docs/.gitkeep b/docs/generated/docs/.gitkeep
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/docs/layouts/partials/home/banner.html b/docs/layouts/partials/home/banner.html
index f327f328fb..54cb2e47db 100644
--- a/docs/layouts/partials/home/banner.html
+++ b/docs/layouts/partials/home/banner.html
@@ -1,9 +1,8 @@
{{ $title := site.Title }}
{{ $description := site.Params.description }}
{{ $tagline := site.Params.tagline }}
-{{ $buttons := site.Params.home.buttons }}
-{{ $mainMenu := site.Menus.main }}
{{ $socialMenu := site.Menus.social }}
+{{ $latest := index site.Data.releases 0 }}
- {{ range $buttons }}
-
- {{ .title }}
+
+ Get started
+
+
+
+ Learn more
- {{ end }}
diff --git a/docs/scripts/load-docs.sh b/docs/scripts/load-docs.sh
index 00a16c4d4e..f7d847fc57 100755
--- a/docs/scripts/load-docs.sh
+++ b/docs/scripts/load-docs.sh
@@ -16,11 +16,13 @@ rm -f ${RELEASES_YAML_FILE}
rm -rf ${ROOT_DIR}/docs/content/docs/v*
for release in ${RELEASES}; do
+ version_docs_dir=${ROOT_DIR}/docs/generated/docs/v${release}
+ mkdir -p ${version_docs_dir}
+
echo "Copying the documentation for release v${release}"
echo "- ${release}" >> ${RELEASES_YAML_FILE}
- mkdir ${ROOT_DIR}/docs/content/docs/v${LATEST}
- cp ${ROOT_DIR}/docs/content/docs/* ${ROOT_DIR}/docs/content/docs/v${LATEST}/
+ cp ${ROOT_DIR}/docs/content/docs/* ${version_docs_dir}/
done
git checkout ${CURRENT_BRANCH}
From d4a3dc31e6025a6046f67968f7d1f0d68c20b8fa Mon Sep 17 00:00:00 2001
From: lucperkins
Date: Sat, 30 Mar 2019 19:02:43 -0700
Subject: [PATCH 2/3] Add git checkout step to docs script
Signed-off-by: lucperkins
---
docs/scripts/load-docs.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/docs/scripts/load-docs.sh b/docs/scripts/load-docs.sh
index f7d847fc57..4a44b27259 100755
--- a/docs/scripts/load-docs.sh
+++ b/docs/scripts/load-docs.sh
@@ -22,6 +22,8 @@ for release in ${RELEASES}; do
echo "Copying the documentation for release v${release}"
echo "- ${release}" >> ${RELEASES_YAML_FILE}
+ git checkout v${release}
+
cp ${ROOT_DIR}/docs/content/docs/* ${version_docs_dir}/
done
From 4d4fcc319b190fb58ffc10c4fca2cb9b53a9540c Mon Sep 17 00:00:00 2001
From: lucperkins
Date: Sat, 30 Mar 2019 19:17:49 -0700
Subject: [PATCH 3/3] Fix container issue on cheatsheet doc
Signed-off-by: lucperkins
---
docs/layouts/partials/docs/article.html | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/docs/layouts/partials/docs/article.html b/docs/layouts/partials/docs/article.html
index 4473da6b31..9777698007 100644
--- a/docs/layouts/partials/docs/article.html
+++ b/docs/layouts/partials/docs/article.html
@@ -1,7 +1,9 @@
-
+
\ No newline at end of file