Skip to content

Commit

Permalink
Merge pull request #531 from SayakMukhopadhyay/upgrade
Browse files Browse the repository at this point in the history
Upgrade website to Docsy 0.5.1
  • Loading branch information
k8s-ci-robot authored Jan 10, 2025
2 parents 326f66b + f72085f commit ec62acc
Show file tree
Hide file tree
Showing 25 changed files with 169 additions and 398 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ RUN apk add --no-cache \

WORKDIR /src

# Required for PostCSS
RUN npm install -G \
autoprefixer \
postcss-cli
COPY package*.json ./

RUN npm ci

RUN mkdir -p /usr/local/src && \
cd /usr/local/src && \
Expand Down
55 changes: 32 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,57 @@

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

# Fast NONBlOCKING IO to stdout caused by the hack/gen-content.sh script can
# cause Netlify builds to terminate unexpectantly. This forces stdout to block.
CONTAINER_HUGO_MOUNTS = \
--read-only \
--mount type=bind,source=$(CURDIR)/.git,target=/src/.git,readonly \
--mount type=bind,source=$(CURDIR)/assets,target=/src/assets,readonly \
--mount type=bind,source=$(CURDIR)/content,target=/src/content,readonly \
--mount type=bind,source=$(CURDIR)/external-sources,target=/src/external-sources,readonly \
--mount type=bind,source=$(CURDIR)/hack,target=/src/hack,readonly \
--mount type=bind,source=$(CURDIR)/layouts,target=/src/layouts,readonly \
--mount type=bind,source=$(CURDIR)/static,target=/src/static,readonly \
--mount type=tmpfs,destination=/tmp,tmpfs-mode=01777 \
--mount type=bind,source=$(CURDIR)/hugo.yaml,target=/src/hugo.yaml,readonly

# Fast NONBLOCKING IO to stdout caused by the hack/gen-content.sh script can
# cause Netlify builds to terminate unexpectedly. This forces stdout to block.
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);"

.DEFAULT_GOAL := help

.PHONY: targets container-targets
targets: help gen-content render serve clean clean-all sproduction preview-build
targets: help gen-content render server clean clean-all production-build preview-build
container-targets: container-image container-gen-content container-render container-server

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

dependencies:
npm ci

gen-content: ## Generates content from external sources.
hack/gen-content.sh

render: ## Build the site using Hugo on the host.
git submodule update --init --recursive --depth 1
hugo --verbose --ignoreCache --minify
render: dependencies ## Build the site using Hugo on the host.
hugo --logLevel info --ignoreCache --minify

server: ## Run Hugo locally (if Hugo "extended" is installed locally)
git submodule update --init --recursive --depth 1
server: dependencies ## Run Hugo locally (if Hugo "extended" is installed locally)
hugo server \
--verbose \
--logLevel info \
--buildDrafts \
--buildFuture \
--disableFastRender \
--ignoreCache

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

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

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

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

container-server: ## Run Hugo locally within a container, available at http://localhost:1313/
# no build lock to allow for read-only mounts
git submodule update --init --recursive --depth 1
$(CONTAINER_RUN) -p 1313:1313 \
--mount type=tmpfs,destination=/tmp,tmpfs-mode=01777 \
--read-only \
$(CONTAINER_RUN_TTY) -p 1313:1313 \
$(CONTAINER_HUGO_MOUNTS) \
--cap-drop=ALL \
--cap-drop=AUDIT_WRITE \
$(CONTAINER_IMAGE) \
bash -c 'cd /src && hack/gen-content.sh --in-container && \
cd /tmp/src && \
hugo server \
--environment preview \
--verbose \
--logLevel info \
--noBuildLock \
--bind 0.0.0.0 \
--buildDrafts \
Expand All @@ -100,7 +111,7 @@ container-server: ## Run Hugo locally within a container, available at http://lo
clean: ## Cleans build artifacts.
rm -rf public/ resources/ _tmp/

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

production-build: ## Builds the production site (this command used only by Netlify).
$(BLOCK_STDOUT_CMD)
git submodule update --init --recursive --depth 1
hack/gen-content.sh
hugo \
--environment production \
--verbose \
--logLevel info \
--ignoreCache \
--minify

preview-build: ## Builds a deploy preview of the site (this command used only by Netlify).
$(BLOCK_STDOUT_CMD)
git submodule update --init --recursive --depth 1
hack/gen-content.sh
hugo \
--environment preview \
--verbose \
--logLevel info \
--baseURL $(DEPLOY_PRIME_URL) \
--buildDrafts \
--buildFuture \
Expand Down
131 changes: 0 additions & 131 deletions assets/scss/_variables.scss

This file was deleted.

2 changes: 2 additions & 0 deletions assets/scss/_variables_project.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
$primary: #326ce5;
$secondary: #303030;
4 changes: 2 additions & 2 deletions hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ baseURL: 'https://www.kubernetes.dev/'
title: Kubernetes Contributors
theme:
- docsy
themesDir: node_modules
enableRobotsTXT: true
enableGitInfo: false

Expand All @@ -13,7 +14,6 @@ enableMissingTranslationPlaceholders: true

disableKinds:
- taxonomy
- taxonomyTerm

# Highlighting config
pygmentsCodeFences: true
Expand Down Expand Up @@ -140,7 +140,7 @@ params:
# The responses that the user sees after clicking "yes" (the page was helpful) or "no" (the page was not helpful).
# yes = 'Glad to hear it! Please <a href="https://github.com/USERNAME/REPOSITORY/issues/new">tell us how we can improve</a>.'
# no = 'Sorry to hear that. Please <a href="https://github.com/USERNAME/REPOSITORY/issues/new">tell us how we can improve</a>.'

links:
# End user relevant links. These will show up on left side of footer and in the community page if you have one.
user:
Expand Down
15 changes: 10 additions & 5 deletions layouts/calendar/baseof.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html lang="{{ .Site.Language.Lang }}" class="no-js">
<html itemscope itemtype="http://schema.org/WebPage" lang="{{ .Site.Language.Lang }}" class="no-js">
<head>
{{ partial "head.html" . }}
<link href='{{ .Site.BaseURL }}/css/fullcalendar/main.min.css' rel='stylesheet' />
Expand All @@ -9,17 +9,22 @@
renderCalendar();
</script>
</head>
<body class="td-{{ .Kind }}">
<body class="td-{{ .Kind }}{{ with .Page.Params.body_class }} {{ . }}{{ end }}">
<header>
{{ partial "navbar.html" . }}
</header>
<div class="container-fluid td-outer">
<div class="td-main">
<div class="row flex-xl-nowrap">
<div class="col-12 col-md-3 col-xl-2 td-sidebar d-print-none">
<aside class="col-12 col-md-3 col-xl-2 td-sidebar d-print-none">
{{ partial "sidebar.html" . }}
</div>
<main class="col-12 col-md-9 col-xl-9 pl-md-5" role="main">
</aside>
<aside class="d-none d-xl-block col-xl-2 td-sidebar-toc d-print-none">
{{ partial "page-meta-links.html" . }}
{{ partial "toc.html" . }}
{{ partial "taxonomy_terms_clouds.html" . }}
</aside>
<main class="col-12 col-md-9 col-xl-8 pl-md-5" role="main">
{{ partial "version-banner.html" . }}
{{ if not .Site.Params.ui.breadcrumb_disable }}{{ partial "breadcrumb.html" . }}{{ end }}
{{ block "main" . }}{{ end }}
Expand Down
21 changes: 17 additions & 4 deletions layouts/calendar/list.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
{{ define "main" }}
<div class="td-content">
<h1>{{ .Title }}</h1>
{{ with .Params.description }}<div class="lead">{{ . | markdownify }}</div>{{ end }}
{{ if (and (not .Params.hide_readingtime) (.Site.Params.ui.readingtime.enable)) }}
{{ partial "reading-time.html" . }}
{{ end }}
{{ with .Params.description }}<div class="lead">{{ . | markdownify }}</div>{{ end }}
<header class="article-meta">
{{ $context := . }}
{{ if .Site.Params.Taxonomy.taxonomyPageHeader }}
{{ range $index, $taxo := .Site.Params.Taxonomy.taxonomyPageHeader }}
{{ partial "taxonomy_terms_article.html" (dict "context" $context "taxo" $taxo ) }}
{{ end }}
{{ else }}
{{ range $taxo, $taxo_map := .Site.Taxonomies }}
{{ partial "taxonomy_terms_article.html" (dict "context" $context "taxo" $taxo ) }}
{{ end }}
{{ end }}
{{ if (and (not .Params.hide_readingtime) (.Site.Params.ui.readingtime.enable)) }}
{{ partial "reading-time.html" . }}
{{ end }}
</header>
{{ .Content }}
{{ partial "section-index.html" . }}
{{ if (and (not .Params.hide_feedback) (.Site.Params.ui.feedback.enable) (.Site.GoogleAnalytics)) }}
Expand All @@ -15,5 +27,6 @@ <h1>{{ .Title }}</h1>
<br />
{{ partial "disqus-comment.html" . }}
{{ end }}
{{ partial "page-meta-lastmod.html" . }}
</div>
{{ end }}
Loading

0 comments on commit ec62acc

Please sign in to comment.