Skip to content

Commit

Permalink
Rework versioning system
Browse files Browse the repository at this point in the history
Signed-off-by: lucperkins <[email protected]>
  • Loading branch information
lucperkins authored and tsandall committed Apr 1, 2019
1 parent afb3851 commit c1f13c4
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 41 deletions.
2 changes: 1 addition & 1 deletion docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ public/
resources/

# Documentation versions
content/docs/v*
generated/docs/v*
data/releases.yaml

# Node.js assets
Expand Down
19 changes: 14 additions & 5 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -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
23 changes: 0 additions & 23 deletions docs/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Empty file added docs/generated/docs/.gitkeep
Empty file.
31 changes: 21 additions & 10 deletions docs/layouts/partials/home/banner.html
Original file line number Diff line number Diff line change
@@ -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 }}
<header role="banner">
<nav class="nav--banner" role="navigation">
<ul class="nav--menu">
Expand All @@ -13,13 +12,23 @@
</a>
</li>

{{ range $mainMenu }}
<li class="nav--menu-item nav--docs">
<a href="{{ .URL }}" rel="help">
{{ .Name }}
<a href="/docs/v{{ $latest }}" rel="help">
Documentation
</a>
</li>

<li class="nav--menu-item nav--docs">
<a href="/docs/v{{ $latest }}/get-started" rel="help">
Tutorials
</a>
</li>

<li class="nav--menu-item nav--docs">
<a href="https://play.openpolicyagent.org" rel="help" target="_blank">
Playground
</a>
</li>
{{ end }}
</ul>
<ul class="nav--menu">
{{ range $socialMenu }}
Expand Down Expand Up @@ -47,11 +56,13 @@ <h1 class="headline--title">
</p>

<p class="headline--nav">
{{ range $buttons }}
<a id="headline--{{ urlize .title }}" href="{{ .url }}" rel="help">
{{ .title }}
<a id="headline--get-started" href="/docs/v{{ $latest }}/get-started" rel="help">
Get started
</a>

<a id="headline--learn-more" href="/docs/v{{ $latest }}" rel="help">
Learn more
</a>
{{ end }}
</p>
</div>

Expand Down
6 changes: 4 additions & 2 deletions docs/scripts/load-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}

0 comments on commit c1f13c4

Please sign in to comment.