Skip to content

Commit

Permalink
Move to docsy as Hugo module
Browse files Browse the repository at this point in the history
Fixes: #889

Signed-off-by: Daniel Holbach <daniel@weave.works>
  • Loading branch information
Daniel Holbach committed Oct 19, 2022
1 parent ddb9281 commit 8a911be
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ updates:
directory: "/" # Location of package manifests
schedule:
interval: "daily"
- package-ecosystem: "gitsubmodule"
- package-ecosystem: "gomod"
directory: "/" # Location of package manifests
schedule:
interval: "daily"
Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ node_modules/
.hugo_build.lock
public/
resources/
themes/docsy
themes/docsy-*
themes/hugo-shortcode-gallery
themes/hugo-shortcode-gallery-*

# clone of gohugoio/hugo for docker-support
hugo/
Expand Down
2 changes: 0 additions & 2 deletions .stignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ _tmp

# These are generated or imported by hack/*
public/
# Output of "make theme"
themes/
!content/en/flux/components/*/_index.md
content/en/flux/components/*/*.md

Expand Down
46 changes: 7 additions & 39 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
BLOCK_STDOUT_CMD := python -c "import os,sys,fcntl; \
flags = fcntl.fcntl(sys.stdout, fcntl.F_GETFL); \
fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags&~os.O_NONBLOCK);"
DOCSY_COMMIT ?= 7489c354a3ca873182e4748ba7bb57cea2d7f468
DOCSY_COMMIT_FOLDER := docsy-$(DOCSY_COMMIT)
DOCSY_TARGET := themes/$(DOCSY_COMMIT_FOLDER)
GALLERY_COMMIT ?= c7d1cd23f718bb74e25a769d5e72443539fb49f8
GALLERY_COMMIT_FOLDER := hugo-shortcode-gallery-$(GALLERY_COMMIT)
GALLERY_TARGET := themes/$(GALLERY_COMMIT_FOLDER)

DEV_IMAGE_REGISTRY_NAME ?= fluxcd
HUGO_VERSION ?= $(shell grep HUGO_VERSION netlify.toml | cut -d'"' -f2)
HUGO_IMAGE_BASE_NAME := website:hugo-$(HUGO_VERSION)-extended
Expand All @@ -25,28 +18,8 @@ help: ## Display this help menu.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
.PHONY: help

theme: $(DOCSY_TARGET) $(GALLERY_TARGET) ## Downloads the themes.

$(DOCSY_TARGET): ## Downloads the Docsy theme.
mkdir -p themes/
rm -rf themes/docsy
curl -Lfs "https://github.com/google/docsy/archive/${DOCSY_COMMIT}.tar.gz" -o "/tmp/${DOCSY_COMMIT_FOLDER}.tar.gz"
tar -zxf "/tmp/${DOCSY_COMMIT_FOLDER}.tar.gz" --directory themes/
mv themes/${DOCSY_COMMIT_FOLDER} themes/docsy
ln -sf docsy themes/${DOCSY_COMMIT_FOLDER}
cd themes/docsy && npm install
cd themes/docsy/assets && ln -s ../node_modules vendor
cd themes/docsy/assets/vendor && \
ln -s ../node_modules vendor && \
ln -s @fortawesome/fontawesome-free/ Font-Awesome

$(GALLERY_TARGET): ## Downloads the hugo-shortcode-gallery theme.
mkdir -p themes/
rm -rf themes/hugo-shortcode-gallery
curl -Lfs "https://github.com/mfg92/hugo-shortcode-gallery/archive/${GALLERY_COMMIT}.tar.gz" -o "/tmp/${GALLERY_COMMIT_FOLDER}.tar.gz"
tar -zxf "/tmp/${GALLERY_COMMIT_FOLDER}.tar.gz" --directory themes/
mv themes/${GALLERY_COMMIT_FOLDER} themes/hugo-shortcode-gallery
ln -sf hugo-shortcode-gallery themes/${GALLERY_COMMIT_FOLDER}
prereqs:
npm install

gen-content: ## Generates content from external sources.
hack/adopters.py
Expand All @@ -55,29 +28,29 @@ gen-content: ## Generates content from external sources.
hack/import-calendar.py
hack/import-flux2-assets.sh

serve: gen-content theme ## Spawns a development server.
serve: gen-content prereqs ## Spawns a development server.
hugo server \
--bind ${HUGO_BIND_ADDRESS} \
--buildDrafts \
--buildFuture \
--disableFastRender

production-build: gen-content theme ## Builds production build.
production-build: gen-content prereqs ## Builds production build.
hugo \
--baseURL $(URL) \
--gc \
--minify \
--enableGitInfo

preview-build: gen-content theme ## Builds a preview build (for e.g. a pull requests).
preview-build: gen-content prereqs ## Builds a preview build (for e.g. a pull requests).
hugo \
--baseURL $(DEPLOY_PRIME_URL) \
--buildFuture \
--gc \
--minify \
--enableGitInfo

branch-build: gen-content theme ## Builds a Git branch (for e.g. development branches).
branch-build: gen-content prereqs ## Builds a Git branch (for e.g. development branches).
hugo \
--baseURL $(DEPLOY_PRIME_URL) \
--buildDrafts \
Expand All @@ -87,12 +60,7 @@ branch-build: gen-content theme ## Builds a Git branch (for e.g. development bra
--enableGitInfo

.PHONY: docker-preview
docker-preview: docker-theme docker-serve

.PHONY: docker-theme
docker-theme:
docker run -v $(shell pwd):/site -it $(SUPPORT_IMAGE_NAME) \
make \"MAKEFLAGS=$(MAKEFLAGS)\" theme
docker-preview: docker-serve

.PHONY: docker-serve
docker-serve:
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Once those tools are installed, fetch the assets necessary to run the site:

```cli
npm install
make theme
python3 -m pip install -r requirements.txt
```

Expand Down
2 changes: 1 addition & 1 deletion assets/scss/main.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import "variables_project";
@import "../../themes/docsy/assets/scss/main.scss";
@import "docsy/main.scss";
@import "buttons";
@import "blocks/blocks";
@import "adopters";
Expand Down
49 changes: 45 additions & 4 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,58 @@ enableRobotsTXT: true
enableEmoji: true

# Language configuration
contentDir: content/en
defaultContentLanguage: en
defaultContentLanguageInSubdir: false
enableMissingTranslationPlaceholders: true

theme: [docsy, hugo-shortcode-gallery]

# Provide .LastMod values
enableGitInfo: true

module:
proxy: direct
hugoVersion:
extended: true
imports:
- path: github.com/google/docsy
disable: false
mounts:
# The following entry is the one we actually need, to be able to
# refer to it in our own assets/scss files.
- source: assets/scss
target: assets/scss/docsy
# Unfortunately that means we need to redefine all of Docsy's
# module mounts here...
# https://github.com/google/docsy/commit/215f68033bbc7bddf8dbec2bbabf8749d1998a17 (lines 24f)
#
# I hope this use-case will be simplified one day.
- source: content
target: content
- source: static
target: static
- source: layouts
target: layouts
- source: data
target: data
- source: assets
target: assets
- source: i18n
target: i18n
- source: archetypes
target: archetypes
- source: node_modules/bootstrap
target: assets/vendor/bootstrap
- source: node_modules/@fortawesome/fontawesome-free
target: assets/vendor/Font-Awesome
- source: node_modules/@fortawesome/fontawesome-free/webfonts
target: static/webfonts
- path: github.com/google/docsy/dependencies
disable: false
- path: github.com/mfg92/hugo-shortcode-gallery
disable: false
mounts:
- source: content/en
target: content

# Markup settings
# Ref: https://gohugo.io/getting-started/configuration-markup#goldmark
markup:
Expand All @@ -33,7 +75,6 @@ languages:
languageCode: en
time_format_default: 2006-01-02
time_format_blog: 2006-01-02
contentDir: content/en

permalinks:
blog: /:section/:year/:month/:slug/
Expand Down
3 changes: 2 additions & 1 deletion content/en/flux/migration/helm-operator-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,8 @@ Probably, but with some side notes:

Helm Controller depends on [Source Controller](../components/source/_index.md), you can install both controllers
and manager Helm releases in a declarative way without GitOps.
For more details please see this [answer]({{< ref "flux/faq/_index.md#can-i-use-flux-helmreleases-without-gitops" >}}).

For more details please see this [answer]({{< relref "../faq.md#can-i-use-flux-helmreleases-without-gitops" >}}).

### I have another question

Expand Down
9 changes: 9 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module github.com/fluxcd/website

go 1.18

require (
github.com/google/docsy v0.5.1-0.20221017155306-99eacb09ffb0 // indirect
github.com/google/docsy/dependencies v0.5.1-0.20221017155306-99eacb09ffb0 // indirect
github.com/mfg92/hugo-shortcode-gallery v0.0.0-20221009204324-c7d1cd23f718 // indirect
)
8 changes: 8 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
github.com/FortAwesome/Font-Awesome v0.0.0-20220831210243-d3a7818c253f/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo=
github.com/google/docsy v0.5.1-0.20221017155306-99eacb09ffb0 h1:BAyzzjQTB5MxdWaXT/n1uCY4L0KBOJ7VAkKks69n9LU=
github.com/google/docsy v0.5.1-0.20221017155306-99eacb09ffb0/go.mod h1:nbAerLgCh3rTKPxh3njZK5EadG4jPzrVs+07VYn1SkQ=
github.com/google/docsy/dependencies v0.5.1-0.20221017155306-99eacb09ffb0 h1:at2I9lLiAiPOdQxRKiT0vOv3oRcSGESIM23MdUvt2gw=
github.com/google/docsy/dependencies v0.5.1-0.20221017155306-99eacb09ffb0/go.mod h1:EDGc2znMbGUw0RW5kWwy2oGgLt0iVXBmoq4UOqstuNE=
github.com/mfg92/hugo-shortcode-gallery v0.0.0-20221009204324-c7d1cd23f718 h1:MA/Morgm61jTM0W7hhnWWA4XD0GBLnAJsaepRsNS8Us=
github.com/mfg92/hugo-shortcode-gallery v0.0.0-20221009204324-c7d1cd23f718/go.mod h1:uP48acoDrLxll/agXBGFRWEv5F237K3XKWyAeVZ+Mm8=
github.com/twbs/bootstrap v4.6.2+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0=
1 change: 1 addition & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[build.environment]
HUGO_VERSION = "0.104.3"
NODE_VERSION = "16"
GO_VERSION = "1.18"

[context.production.environment]
HUGO_ENV = "production"
Expand Down
2 changes: 1 addition & 1 deletion okteto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ workdir: /site
command:
- sh
- -c
- make theme; make serve
- make serve
autocreate: true
forward:
- 1313:1313
Expand Down

0 comments on commit 8a911be

Please sign in to comment.