Skip to content

Commit f522e6d

Browse files
committed
Refactor header inclusion logic for using productCode Hugo configuration parameter
Signed-off-by: Artem Kladov <artem.kladov@flant.com>
1 parent 5ad52e2 commit f522e6d

File tree

5 files changed

+7
-51
lines changed

5 files changed

+7
-51
lines changed

layouts/_partials/get-remote-asset.html

Lines changed: 0 additions & 21 deletions
This file was deleted.

layouts/_partials/get-remote-include.html

Lines changed: 0 additions & 14 deletions
This file was deleted.

layouts/_partials/head-site.html

Lines changed: 0 additions & 10 deletions
This file was deleted.

layouts/baseof.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
</head>
88
<body>
99
<div class="content">
10-
{{- "<!--#include virtual=\"/includes/header.html\" -->" | safeHTML }}
10+
{{- $partialPath := "header.html" }} {{/* Set a default */}}
11+
{{- with .Site.Params.productCode }}
12+
{{- $partialPath = printf "header-%s.html" . }}
13+
{{- end }}
14+
{{- printf "<!-- #include virtual=\"/includes/%s\" -->" $partialPath | safeHTML }}
1115

1216
<div class="container">
1317

project_template/config/_default/hugo.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,15 @@ sitemap:
5656
priority: 0.75
5757

5858
params:
59+
# The same as in the /products/<APP>/ doc URL prefix
60+
productCode: XXXX
5961
analytics:
6062
google: XXXX
6163
yandex: XXXX
6264
# GitHub repository link for editing a page and opening issues.
6365
github_repo: https://github.com/deckhouse/XXXX
6466
# Show "Edit this page" link
6567
showedit: true
66-
remoteAssetURL: /includes/
6768

6869
# Enable Lunr.js offline search
6970
offlineSearch: false
@@ -75,10 +76,6 @@ module:
7576
imports:
7677
# Site templates
7778
- path: github.com/deckhouse/hugo-web-product-module
78-
#mounts:
79-
# - source: docs/api
80-
# target: content/reference/api/engine/version
81-
# includeFiles: "*.yaml"
8279

8380
languages:
8481
en:

0 commit comments

Comments
 (0)