Remove “local” and “production” doc builds..

..There can be only one.

The groundwork was laid in previous patches but this finishes the
process of removing the local/dev/preview builds. We now only have
a single doc build that will show *all* content.

Signed-off-by: Patrick East <east.patrick@gmail.com>
This commit is contained in:
Patrick East
2019-04-24 23:00:47 -07:00
parent c8ea625d65
commit 2483b6dd2e
8 changed files with 23 additions and 155 deletions
+9 -14
View File
@@ -1,5 +1,7 @@
clean:
rm -rf generated
rm -rf public
rm -rf resources
load-docs:
scripts/load-docs.sh
@@ -8,22 +10,14 @@ setup:
npm install
serve:
@echo "- latest" > ./data/releases.yaml
ENV=local hugo server \
--buildDrafts \
--buildFuture
hugo server --contentDir generated
docker-serve:
docker run --rm -it \
-v $(PWD):/src \
-p 1313:1313 \
-e ENV=local \
klakegg/hugo:0.53-ext server \
--buildDrafts \
--buildFuture
local-production-serve: clean load-docs
hugo server --contentDir generated
--contentDir /src/generated
production-build: clean load-docs
hugo \
@@ -31,9 +25,9 @@ production-build: clean load-docs
--ignoreCache \
--minify
preview-build: clean
@echo "- latest" > ./data/releases.yaml
ENV=local hugo \
preview-build: clean load-docs
hugo \
--contentDir generated \
--baseURL $(DEPLOY_PRIME_URL) \
--buildDrafts \
--buildFuture \
@@ -42,9 +36,10 @@ preview-build: clean
linkcheck-build:
hugo \
--contentDir generated \
--baseURL "/" \
--buildDrafts \
--buildFuture
linkcheck: clean linkcheck-build
linkcheck: clean load-docs linkcheck-build
htmlproofer ./public --empty-alt-ignore
+11 -29
View File
@@ -14,24 +14,22 @@ directory.
## Run the site locally
You can run the site locally [with Docker](#run-the-site-locally-using-docker) or
[without Docker](#run-the-site-locally-without-docker). Regardless of your method,
you'll need install [npm](https://www.npmjs.com/get-npm).
[without Docker](#run-the-site-locally-without-docker).
### Run the site locally using Docker
### Generating Versioned Content ###
The site will show all versions of doc content from the tagged versions listed
in [RELEASES](./RELEASES).
To run the site locally using [Docker](https://docker.com), first install the
necessary static assets using npm:
```bash
npm install
```
Generate some required files:
```bash
To generate them run:
```shell
make load-docs
```
Then, if [Docker is running](https://docs.docker.com/get-started/):
The content then will be placed into `docs/generated/docs/$VERSION/`.
### Run the site locally using Docker
If [Docker is running](https://docs.docker.com/get-started/):
```bash
make docker-serve
@@ -45,7 +43,6 @@ are available at http://localhost:1313/docs.
To build and serve the site locally without using Docker, install the following packages
on your system:
- [npm](https://npmjs.org)
- The [Hugo](#installing-hugo) static site generator
#### Installing Hugo
@@ -65,14 +62,6 @@ using the non-extended version:
error: failed to transform resource: TOCSS: failed to transform "sass/style.sass" (text/x-sass): this feature is not available in your current Hugo version
```
#### Installing static assets
The OPA website requires some static assets installable via npm:
```bash
npm install
```
#### Serving the site
From this directory:
@@ -84,13 +73,6 @@ make serve
Open your browser to http://localhost:1313 to see the site running locally. The docs
are available at http://localhost:1313/docs.
> The local version of the site is different from the production site at
> https://openpolicyagent.org in important ways. When running the site locally,
> the documentation you'll see is from the current branch, not from any past release.
> Thus, there is no version selector or concept of documentation versions in the
> "dev" site. The documentation that you see when running the site locally will be
> visible on the production site only when that documentation has been included as
> part of an OPA release.
## Site updates
-3
View File
@@ -1,8 +1,6 @@
{{- $localMode := eq (getenv "ENV") "local" }}
{{- $latest := index site.Data.releases 0 -}}
{{- $allDocs := where site.RegularPages "Section" "docs" }}
{{- $docRedirects := site.Data.redirects }}
{{- if not $localMode }}
# Redirect to latest doc version by default
/docs /docs/latest
@@ -20,4 +18,3 @@
# Legacy git book redirects
/docs/{{ . }}.html /docs/{{ $latest }}/{{ . }}
{{- end }}
{{- end }}
@@ -1,4 +1,3 @@
{{ $localMode := eq (getenv "ENV") "local" }}
{{ $home := site.BaseURL }}
{{ $logo := site.Params.logos.sidebar | relURL }}
{{ $releases := site.Data.releases }}
@@ -14,7 +13,6 @@
</a>
</div>
{{ if not $localMode }}
{{ $latest := index site.Data.releases 0 }}
<div class="dropdown is-left">
<div class="dropdown-trigger">
@@ -59,7 +57,6 @@
</div>
</div>
</div>
{{ end }}
</div>
<div class="dashboard-panel-content is-scrollable">
-5
View File
@@ -1,4 +1,3 @@
{{ $localMode := eq (getenv "ENV") "local" }}
{{ $docsHome := .CurrentSection }}
{{ $allDocs := where site.RegularPages "Section" "docs" }}
{{ $docs := where $allDocs ".Params.kind" "eq" "documentation" }}
@@ -8,9 +7,5 @@
{{ $pageUrl := .URL }}
{{ $isDocsHome := eq .URL $docsHome.URL }}
<div class="docs-nav">
{{ if $localMode }}
{{ partial "docs/sidenav/local.html" . }}
{{ else }}
{{ partial "docs/sidenav/production.html" . }}
{{ end }}
</div>
@@ -1,94 +0,0 @@
{{ $allDocs := where site.RegularPages "Section" "docs" }}
{{ $docs := where $allDocs ".Params.kind" "eq" "documentation" }}
{{ $tutorials := where $allDocs ".Params.kind" "eq" "tutorial" }}
{{ $guides := where $allDocs ".Params.kind" "eq" "guides" }}
{{ $bestPrac := where $allDocs ".Params.kind" "eq" "best-practices" }}
{{ $pageUrl := .URL }}
{{ $isDocsHome := eq .URL "/docs/" }}
<span class="docs-nav-title">
Documentation
</span>
<a class="docs-nav-item{{ if $isDocsHome }} is-active{{ end }}" href="/docs">
Introduction
</a>
{{ if $isDocsHome }}
<div class="toc">
{{ .TableOfContents }}
</div>
{{ end }}
{{ range $docs }}
{{ $isThisPage := eq .URL $pageUrl }}
{{ $title := cond (isset .Params "navtitle") (.Params.navtitle) .Title }}
<a class="docs-nav-item{{ if $isThisPage }} is-active{{ end }}" href="{{ .URL }}">
{{ $title }}
</a>
{{ if $isThisPage }}
<div class="toc">
{{ .TableOfContents }}
</div>
{{ end }}
{{ end }}
<hr class="docs-nav-hr" />
<span class="docs-nav-title">
Tutorials
</span>
{{ range $tutorials }}
{{ $isThisPage := eq .URL $pageUrl }}
{{ $title := cond (isset .Params "navtitle") (.Params.navtitle) .Title }}
<a class="docs-nav-item{{ if $isThisPage }} is-active{{ end }}" href="{{ .URL }}">
{{ $title }}
</a>
{{ if $isThisPage }}
<div class="toc">
{{ .TableOfContents }}
</div>
{{ end }}
{{ end }}
{{ with $guides }}
<hr class="docs-nav-hr" />
<span class="docs-nav-title">
Guides
</span>
{{ range . }}
{{ $isThisPage := eq .URL $pageUrl }}
{{ $title := cond (isset .Params "navtitle") (.Params.navtitle) .Title }}
<a class="docs-nav-item{{ if $isThisPage }} is-active{{ end }}" href="{{ .URL }}">
{{ $title }}
</a>
{{ if $isThisPage }}
<div class="toc">
{{ .TableOfContents }}
</div>
{{ end }}
{{ end }}
{{ end }}
{{ with $bestPrac }}
<hr class="docs-nav-hr" />
<span class="docs-nav-title">
Best practices
</span>
{{ range . }}
{{ $isThisPage := eq .URL $pageUrl }}
{{ $title := cond (isset .Params "navtitle") (.Params.navtitle) .Title }}
<a class="docs-nav-item{{ if $isThisPage }} is-active{{ end }}" href="{{ .URL }}">
{{ $title }}
</a>
{{ if $isThisPage }}
<div class="toc">
{{ .TableOfContents }}
</div>
{{ end }}
{{ end }}
{{ end }}
+2 -3
View File
@@ -1,11 +1,10 @@
{{ $localMode := eq (getenv "ENV") "local" }}
{{ $title := site.Title }}
{{ $description := site.Params.description }}
{{ $tagline := site.Params.tagline }}
{{ $socialMenu := site.Menus.social }}
{{ $latest := index site.Data.releases 0 }}
{{ $docs := cond $localMode "/docs" (printf "/docs/%s" $latest) }}
{{ $getStarted := cond $localMode "/docs/get-started" (printf "/docs/%s/get-started" $latest) }}
{{ $docs := printf "/docs/%s" $latest }}
{{ $getStarted := printf "/docs/%s/get-started" $latest }}
<header role="banner">
<nav class="nav--banner" role="navigation">
<ul class="nav--menu">
+1 -4
View File
@@ -1,4 +1 @@
{{- $latestMode := eq (getenv "ENV") "local" -}}
{{- if not $latestMode -}}
{{ index site.Data.releases 0 }}
{{- end -}}
{{ index site.Data.releases 0 }}