Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix documentation loading script #1301

Merged
merged 3 commits into from
Apr 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
12 changes: 7 additions & 5 deletions docs/layouts/partials/docs/article.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<article class="article">
<section class="section">
<div class="content">
{{ .Content }}
</div>
</section>
<div class="container">
<section class="section">
<div class="content">
{{ .Content }}
</div>
</section>
</div>
</article>
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
8 changes: 6 additions & 2 deletions docs/scripts/load-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ 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}/
git checkout v${release}

cp ${ROOT_DIR}/docs/content/docs/* ${version_docs_dir}/
done

git checkout ${CURRENT_BRANCH}