Skip to content

Commit c55884c

Browse files
committed
feat(techdocs): Add additional metadata
This changes adds the following metadata to each page - list of contributors - creation date
1 parent d928bc8 commit c55884c

File tree

6 files changed

+27
-8
lines changed

6 files changed

+27
-8
lines changed

images/techdocs/context/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,19 @@ linguistics-check: validate-pwd vale-sync ## Check spelling, grammar and other l
102102
vale $(MARKDOWN_FILES)
103103

104104
SITE_NAME := $(shell yq --no-doc 'select(document_index == 0) | .metadata.title // .metadata.name' ./catalog-info.yaml)
105+
REPO_NAME := $(shell yq --no-doc 'select(document_index == 0) | .metadata.annotations."github.com/project-slug"' ./catalog-info.yaml)
106+
ENTITY := $(shell yq --no-doc 'select(document_index == 0) | [.metadata.namespace // "default", .kind, .metadata.name] | join("/")' ./catalog-info.yaml)
105107

106108
.PHONY: mkdocs.yml
107109
mkdocs.yml: /usr/local/share/techdocs/mkdocs.yml
108110
cp /usr/local/share/techdocs/mkdocs.yml mkdocs.yml
109111

110112
.PHONY: build
111113
build: mkdocs.yml ## Build the website
112-
export SITE_NAME="$(SITE_NAME)" && export REPO_NAME=$(REPO_NAME) export REPO_URL=$(REPO_URL) && export EDIT_URI=$(EDIT_URI) && techdocs-cli generate --no-docker
113-
114-
ENTITY := $(shell yq --no-doc 'select(document_index == 0) | [.metadata.namespace // "default", .kind, .metadata.name] | join("/")' ./catalog-info.yaml)
114+
export SITE_NAME="$(SITE_NAME)" && export REPO_NAME=$(REPO_NAME) && export REPO_URL=$(REPO_URL) && export EDIT_URI=$(EDIT_URI) && export FETCH_CONTRIBUTORS=$(FETCH_CONTRIBUTORS) && techdocs-cli generate --no-docker --verbose
115115

116116
serve: mkdocs.yml ## Run a preview site
117-
export SITE_NAME="$(SITE_NAME)" && export REPO_NAME=$(REPO_NAME) export REPO_URL=$(REPO_URL) && export EDIT_URI=$(EDIT_URI) && techdocs-cli serve --no-docker
117+
export SITE_NAME="$(SITE_NAME)" && export REPO_NAME=$(REPO_NAME) && export REPO_URL=$(REPO_URL) && export EDIT_URI=$(EDIT_URI) && export FETCH_CONTRIBUTORS=$(FETCH_CONTRIBUTORS) && techdocs-cli serve --no-docker --verbose
118118

119119
.PHONY: publish
120120
publish: site ## Publish the website to the TechDocs Bucket

images/techdocs/context/mkdocs.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,22 @@ site_name: !ENV SITE_NAME
22
repo_name: !ENV [REPO_NAME, null]
33
repo_url: !ENV [REPO_URL, null]
44
edit_uri: !ENV [EDIT_URI, null]
5+
theme:
6+
name: material
57
plugins:
68
- techdocs-core
9+
- material/meta
710
- htmlproofer:
811
validate_external_urls: false
912
- git-revision-date-localized:
1013
fallback_to_build_date: true
14+
enable_creation_date: true
15+
- git-committers:
16+
repository: !ENV [REPO_NAME, null]
17+
branch: main
18+
enabled: !ENV [FETCH_CONTRIBUTORS, false]
19+
exclude_committers:
20+
- "web-flow"
1121
- awesome-pages
1222
- ezlinks:
1323
warn_ambiguities: true

images/techdocs/context/requirements-techdocs.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ mkdocs-link-marker==0.1.3
88
mkdocs-table-reader-plugin==3.1.0
99
mkdocs-techdocs-core==1.5.4
1010
pymdown-extensions==10.14.3
11+
mkdocs-git-committers-plugin-2==2.5.0

images/techdocs/context/requirements-techdocs.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ gitdb==4.0.11 \
145145
gitpython==3.1.44 \
146146
--hash=sha256:9e0e10cda9bed1ee64bc9a6de50e7e38a9c9943241cd7f585f6df3ed28011110 \
147147
--hash=sha256:c87e30b26253bf5418b01b0660f818967f3c503193838337fe5e573331249269
148-
# via mkdocs-git-revision-date-localized-plugin
148+
# via
149+
# mkdocs-git-committers-plugin-2
150+
# mkdocs-git-revision-date-localized-plugin
149151
idna==3.7 \
150152
--hash=sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc \
151153
--hash=sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0
@@ -258,6 +260,7 @@ mkdocs==1.6.0 \
258260
# via
259261
# mkdocs-awesome-pages-plugin
260262
# mkdocs-ezlinks-plugin
263+
# mkdocs-git-committers-plugin-2
261264
# mkdocs-git-revision-date-localized-plugin
262265
# mkdocs-htmlproofer-plugin
263266
# mkdocs-kroki-plugin
@@ -278,6 +281,10 @@ mkdocs-get-deps==0.2.0 \
278281
--hash=sha256:162b3d129c7fad9b19abfdcb9c1458a651628e4b1dea628ac68790fb3061c60c \
279282
--hash=sha256:2bf11d0b133e77a0dd036abeeb06dec8775e46efa526dc70667d8863eefc6134
280283
# via mkdocs
284+
mkdocs-git-committers-plugin-2==2.5.0 \
285+
--hash=sha256:1778becf98ccdc5fac809ac7b62cf01d3c67d6e8432723dffbb823307d1193c4 \
286+
--hash=sha256:a01f17369e79ca28651681cddf212770e646e6191954bad884ca3067316aae60
287+
# via -r requirements-techdocs.in
281288
mkdocs-git-revision-date-localized-plugin==1.4.5 \
282289
--hash=sha256:395ae0b9eec565c78a76fffc938b70f52774bf2971245482d31aba47018c5fa9 \
283290
--hash=sha256:9e37f1343d314c9cd8f9cbbf117c4bdc1d2d24a0653c5bbd7059d072f2cd0972
@@ -507,6 +514,7 @@ requests==2.32.0 \
507514
--hash=sha256:f2c3881dddb70d056c5bd7600a4fae312b2a300e39be6a118d30b90bd27262b5 \
508515
--hash=sha256:fa5490319474c82ef1d2c9bc459d3652e3ae4ef4c4ebdd18a21145a47ca4b6b8
509516
# via
517+
# mkdocs-git-committers-plugin-2
510518
# mkdocs-htmlproofer-plugin
511519
# mkdocs-kroki-plugin
512520
# mkdocs-material

images/techdocs/tests/prototype/catalog-info.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ metadata:
66
title: Test Prototype
77
description: This is a test protoype
88
annotations:
9-
github.com/project-slug: example/test-prototype
9+
github.com/project-slug: example/test
1010
backstage.io/techdocs-ref: dir:.
1111
spec:
1212
type: library
@@ -20,7 +20,7 @@ metadata:
2020
title: Test Prototype 2
2121
description: This is a test protoype
2222
annotations:
23-
github.com/project-slug: example/test-prototype
23+
github.com/project-slug: example/test
2424
backstage.io/techdocs-ref: dir:.
2525
spec:
2626
type: library

images/techdocs/tests/test_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def test_build(
155155
) -> None:
156156
actual_output = docker_client.containers.run(
157157
build_image.id,
158-
command='build REPO_NAME=example/test REPO_URL="http://github.com/example/test" EDIT_URL="edit/main/docs"',
158+
command='build REPO_URL="http://github.com/example/test" EDIT_URL="edit/main/docs FETCH_CONTRIBUTORS=false"',
159159
volumes=volumes,
160160
remove=True,
161161
)

0 commit comments

Comments
 (0)