Skip to content

Commit bc657d2

Browse files
committed
feat: Hugo segments
1 parent c4c7d1a commit bc657d2

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ HUGO_VERSION = $(shell grep ^HUGO_VERSION netlify.toml | tail -n 1 | cut -d
22
NODE_BIN = node_modules/.bin
33
NETLIFY_FUNC = $(NODE_BIN)/netlify-lambda
44

5+
# The segments variable is used to specify which segments to render.
6+
segments ?= all
7+
58
# The CONTAINER_ENGINE variable is used for specifying the container engine. By default 'docker' is used
69
# but this can be overridden when calling make, e.g.
710
# CONTAINER_ENGINE=podman make container-image
@@ -69,7 +72,7 @@ non-production-build: module-check ## Build the non-production site, which adds
6972
GOMAXPROCS=1 hugo --cleanDestinationDir --enableGitInfo --environment nonprod
7073

7174
serve: module-check ## Boot the development server.
72-
hugo server --buildDrafts --buildFuture --environment development
75+
hugo server --buildDrafts --buildFuture --environment development --renderSegments $(segments)
7376

7477
docker-image:
7578
@echo -e "$(CCRED)**** The use of docker-image is deprecated. Use container-image instead. ****$(CCEND)"
@@ -118,7 +121,7 @@ container-build: module-check
118121
container-serve: module-check ## Boot the development server using container.
119122
$(CONTAINER_RUN_TTY) --cap-drop=ALL --cap-add=AUDIT_WRITE $(CONTAINER_HUGO_MOUNTS) \
120123
-p 1313:1313 $(CONTAINER_IMAGE) \
121-
hugo server --buildDrafts --buildFuture --environment development --bind 0.0.0.0 --destination /tmp/public --cleanDestinationDir --noBuildLock
124+
hugo server --buildDrafts --buildFuture --environment development --bind 0.0.0.0 --destination /tmp/public --cleanDestinationDir --noBuildLock --renderSegments $(segments)
122125

123126
test-examples:
124127
scripts/test_examples.sh install

hugo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,3 +568,11 @@ target = "i18n"
568568
[[module.mounts]]
569569
source = "i18n/zh-cn"
570570
target = "i18n"
571+
572+
[segments]
573+
[segments.all]
574+
[[segments.all.includes]]
575+
path = '{/**}'
576+
[segments.en]
577+
[[segments.en.includes]]
578+
lang = 'en'

0 commit comments

Comments
 (0)