Skip to content

Commit ec62acc

Browse files
authored
Merge pull request #531 from SayakMukhopadhyay/upgrade
Upgrade website to Docsy 0.5.1
2 parents 326f66b + f72085f commit ec62acc

25 files changed

+169
-398
lines changed

.gitmodules

-3
This file was deleted.

Dockerfile

+3-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@ RUN apk add --no-cache \
1818

1919
WORKDIR /src
2020

21-
# Required for PostCSS
22-
RUN npm install -G \
23-
autoprefixer \
24-
postcss-cli
21+
COPY package*.json ./
22+
23+
RUN npm ci
2524

2625
RUN mkdir -p /usr/local/src && \
2726
cd /usr/local/src && \

Makefile

+32-23
Original file line numberDiff line numberDiff line change
@@ -14,43 +14,57 @@
1414

1515
CONTAINER_ENGINE ?= docker
1616
CONTAINER_RUN := $(CONTAINER_ENGINE) run --rm -it -v "$(CURDIR):/src"
17+
CONTAINER_RUN_TTY := $(CONTAINER_ENGINE) run --rm -it
1718
HUGO_VERSION := $(shell grep ^HUGO_VERSION netlify.toml | tail -n 1 | cut -d '=' -f 2 | tr -d " \"\n")
1819
CONTAINER_IMAGE := k8s-contrib-site-hugo
19-
REPO_ROOT :=${CURDIR}
2020

21-
# Fast NONBlOCKING IO to stdout caused by the hack/gen-content.sh script can
22-
# cause Netlify builds to terminate unexpectantly. This forces stdout to block.
21+
CONTAINER_HUGO_MOUNTS = \
22+
--read-only \
23+
--mount type=bind,source=$(CURDIR)/.git,target=/src/.git,readonly \
24+
--mount type=bind,source=$(CURDIR)/assets,target=/src/assets,readonly \
25+
--mount type=bind,source=$(CURDIR)/content,target=/src/content,readonly \
26+
--mount type=bind,source=$(CURDIR)/external-sources,target=/src/external-sources,readonly \
27+
--mount type=bind,source=$(CURDIR)/hack,target=/src/hack,readonly \
28+
--mount type=bind,source=$(CURDIR)/layouts,target=/src/layouts,readonly \
29+
--mount type=bind,source=$(CURDIR)/static,target=/src/static,readonly \
30+
--mount type=tmpfs,destination=/tmp,tmpfs-mode=01777 \
31+
--mount type=bind,source=$(CURDIR)/hugo.yaml,target=/src/hugo.yaml,readonly
32+
33+
# Fast NONBLOCKING IO to stdout caused by the hack/gen-content.sh script can
34+
# cause Netlify builds to terminate unexpectedly. This forces stdout to block.
2335
BLOCK_STDOUT_CMD := python -c "import os,sys,fcntl; \
2436
flags = fcntl.fcntl(sys.stdout, fcntl.F_GETFL); \
2537
fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags&~os.O_NONBLOCK);"
2638

2739
.DEFAULT_GOAL := help
2840

2941
.PHONY: targets container-targets
30-
targets: help gen-content render serve clean clean-all sproduction preview-build
42+
targets: help gen-content render server clean clean-all production-build preview-build
3143
container-targets: container-image container-gen-content container-render container-server
3244

3345
help: ## Show this help text.
3446
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
3547

48+
dependencies:
49+
npm ci
50+
3651
gen-content: ## Generates content from external sources.
3752
hack/gen-content.sh
3853

39-
render: ## Build the site using Hugo on the host.
40-
git submodule update --init --recursive --depth 1
41-
hugo --verbose --ignoreCache --minify
54+
render: dependencies ## Build the site using Hugo on the host.
55+
hugo --logLevel info --ignoreCache --minify
4256

43-
server: ## Run Hugo locally (if Hugo "extended" is installed locally)
44-
git submodule update --init --recursive --depth 1
57+
server: dependencies ## Run Hugo locally (if Hugo "extended" is installed locally)
4558
hugo server \
46-
--verbose \
59+
--logLevel info \
4760
--buildDrafts \
4861
--buildFuture \
4962
--disableFastRender \
5063
--ignoreCache
5164

52-
docker-image: container-image
65+
docker-image:
5366
@echo -e "**** The use of docker-image is deprecated. Use container-image instead. ****" 1>&2
67+
$(MAKE) container-image
5468

5569
container-image: ## Build container image for use with container-* targets.
5670
$(CONTAINER_ENGINE) build . -t $(CONTAINER_IMAGE) --build-arg HUGO_VERSION=$(HUGO_VERSION)
@@ -67,27 +81,24 @@ docker-render:
6781
$(MAKE) container-render
6882

6983
container-render: ## Build the site using Hugo within a container (equiv to render).
70-
git submodule update --init --recursive --depth 1
71-
$(CONTAINER_RUN) $(CONTAINER_IMAGE) hugo --verbose --ignoreCache --minify
84+
$(CONTAINER_RUN_TTY) $(CONTAINER_HUGO_MOUNTS) $(CONTAINER_IMAGE) hugo --logLevel info --ignoreCache --minify
7285

7386
docker-server:
7487
@echo -e "**** The use of docker-server is deprecated. Use container-server instead. ****" 1>&2
7588
$(MAKE) container-server
7689

7790
container-server: ## Run Hugo locally within a container, available at http://localhost:1313/
7891
# no build lock to allow for read-only mounts
79-
git submodule update --init --recursive --depth 1
80-
$(CONTAINER_RUN) -p 1313:1313 \
81-
--mount type=tmpfs,destination=/tmp,tmpfs-mode=01777 \
82-
--read-only \
92+
$(CONTAINER_RUN_TTY) -p 1313:1313 \
93+
$(CONTAINER_HUGO_MOUNTS) \
8394
--cap-drop=ALL \
8495
--cap-drop=AUDIT_WRITE \
8596
$(CONTAINER_IMAGE) \
8697
bash -c 'cd /src && hack/gen-content.sh --in-container && \
8798
cd /tmp/src && \
8899
hugo server \
89100
--environment preview \
90-
--verbose \
101+
--logLevel info \
91102
--noBuildLock \
92103
--bind 0.0.0.0 \
93104
--buildDrafts \
@@ -100,7 +111,7 @@ container-server: ## Run Hugo locally within a container, available at http://lo
100111
clean: ## Cleans build artifacts.
101112
rm -rf public/ resources/ _tmp/
102113

103-
clean-all: ## Cleans both build artifacts and files sycned to content directory
114+
clean-all: ## Cleans both build artifacts and files synced to content directory
104115
rm -rf public/ resources/ _tmp/
105116
rm -f content/en/events/community-meeting.md
106117
rm -f content/en/events/meet-our-contributors.md
@@ -129,21 +140,19 @@ clean-all: ## Cleans both build artifacts and files sycned to content directory
129140

130141
production-build: ## Builds the production site (this command used only by Netlify).
131142
$(BLOCK_STDOUT_CMD)
132-
git submodule update --init --recursive --depth 1
133143
hack/gen-content.sh
134144
hugo \
135145
--environment production \
136-
--verbose \
146+
--logLevel info \
137147
--ignoreCache \
138148
--minify
139149

140150
preview-build: ## Builds a deploy preview of the site (this command used only by Netlify).
141151
$(BLOCK_STDOUT_CMD)
142-
git submodule update --init --recursive --depth 1
143152
hack/gen-content.sh
144153
hugo \
145154
--environment preview \
146-
--verbose \
155+
--logLevel info \
147156
--baseURL $(DEPLOY_PRIME_URL) \
148157
--buildDrafts \
149158
--buildFuture \

assets/scss/_variables.scss

-131
This file was deleted.

assets/scss/_variables_project.scss

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
$primary: #326ce5;
2+
$secondary: #303030;

hugo.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ baseURL: 'https://www.kubernetes.dev/'
22
title: Kubernetes Contributors
33
theme:
44
- docsy
5+
themesDir: node_modules
56
enableRobotsTXT: true
67
enableGitInfo: false
78

@@ -13,7 +14,6 @@ enableMissingTranslationPlaceholders: true
1314

1415
disableKinds:
1516
- taxonomy
16-
- taxonomyTerm
1717

1818
# Highlighting config
1919
pygmentsCodeFences: true
@@ -140,7 +140,7 @@ params:
140140
# The responses that the user sees after clicking "yes" (the page was helpful) or "no" (the page was not helpful).
141141
# yes = 'Glad to hear it! Please <a href="https://github.com/USERNAME/REPOSITORY/issues/new">tell us how we can improve</a>.'
142142
# no = 'Sorry to hear that. Please <a href="https://github.com/USERNAME/REPOSITORY/issues/new">tell us how we can improve</a>.'
143-
143+
144144
links:
145145
# End user relevant links. These will show up on left side of footer and in the community page if you have one.
146146
user:

layouts/calendar/baseof.html

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html lang="{{ .Site.Language.Lang }}" class="no-js">
2+
<html itemscope itemtype="http://schema.org/WebPage" lang="{{ .Site.Language.Lang }}" class="no-js">
33
<head>
44
{{ partial "head.html" . }}
55
<link href='{{ .Site.BaseURL }}/css/fullcalendar/main.min.css' rel='stylesheet' />
@@ -9,17 +9,22 @@
99
renderCalendar();
1010
</script>
1111
</head>
12-
<body class="td-{{ .Kind }}">
12+
<body class="td-{{ .Kind }}{{ with .Page.Params.body_class }} {{ . }}{{ end }}">
1313
<header>
1414
{{ partial "navbar.html" . }}
1515
</header>
1616
<div class="container-fluid td-outer">
1717
<div class="td-main">
1818
<div class="row flex-xl-nowrap">
19-
<div class="col-12 col-md-3 col-xl-2 td-sidebar d-print-none">
19+
<aside class="col-12 col-md-3 col-xl-2 td-sidebar d-print-none">
2020
{{ partial "sidebar.html" . }}
21-
</div>
22-
<main class="col-12 col-md-9 col-xl-9 pl-md-5" role="main">
21+
</aside>
22+
<aside class="d-none d-xl-block col-xl-2 td-sidebar-toc d-print-none">
23+
{{ partial "page-meta-links.html" . }}
24+
{{ partial "toc.html" . }}
25+
{{ partial "taxonomy_terms_clouds.html" . }}
26+
</aside>
27+
<main class="col-12 col-md-9 col-xl-8 pl-md-5" role="main">
2328
{{ partial "version-banner.html" . }}
2429
{{ if not .Site.Params.ui.breadcrumb_disable }}{{ partial "breadcrumb.html" . }}{{ end }}
2530
{{ block "main" . }}{{ end }}

layouts/calendar/list.html

+17-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
{{ define "main" }}
22
<div class="td-content">
33
<h1>{{ .Title }}</h1>
4-
{{ with .Params.description }}<div class="lead">{{ . | markdownify }}</div>{{ end }}
5-
{{ if (and (not .Params.hide_readingtime) (.Site.Params.ui.readingtime.enable)) }}
6-
{{ partial "reading-time.html" . }}
7-
{{ end }}
4+
{{ with .Params.description }}<div class="lead">{{ . | markdownify }}</div>{{ end }}
5+
<header class="article-meta">
6+
{{ $context := . }}
7+
{{ if .Site.Params.Taxonomy.taxonomyPageHeader }}
8+
{{ range $index, $taxo := .Site.Params.Taxonomy.taxonomyPageHeader }}
9+
{{ partial "taxonomy_terms_article.html" (dict "context" $context "taxo" $taxo ) }}
10+
{{ end }}
11+
{{ else }}
12+
{{ range $taxo, $taxo_map := .Site.Taxonomies }}
13+
{{ partial "taxonomy_terms_article.html" (dict "context" $context "taxo" $taxo ) }}
14+
{{ end }}
15+
{{ end }}
16+
{{ if (and (not .Params.hide_readingtime) (.Site.Params.ui.readingtime.enable)) }}
17+
{{ partial "reading-time.html" . }}
18+
{{ end }}
19+
</header>
820
{{ .Content }}
921
{{ partial "section-index.html" . }}
1022
{{ if (and (not .Params.hide_feedback) (.Site.Params.ui.feedback.enable) (.Site.GoogleAnalytics)) }}
@@ -15,5 +27,6 @@ <h1>{{ .Title }}</h1>
1527
<br />
1628
{{ partial "disqus-comment.html" . }}
1729
{{ end }}
30+
{{ partial "page-meta-lastmod.html" . }}
1831
</div>
1932
{{ end }}

0 commit comments

Comments
 (0)