Skip to content
This repository was archived by the owner on Nov 13, 2024. It is now read-only.

Commit 777ddfb

Browse files
committed
#1: Add custom title logic
1 parent d09dfe6 commit 777ddfb

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

bin/build.sh

+10-2
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ function help() {
2424
echo " ${0} [options]"
2525
echo "Options:"
2626
echo " -h Usage help; this message."
27-
echo " -m Maintain original mkdocs.yml file."
27+
echo " -m Maintain the original mkdocs.yml file."
28+
echo " -t <title> Change the site title."
2829
echo " -u <url> Deployment URL of documentation (to ensure search works)"
2930
}
3031

31-
while getopts hmu: option;do
32+
while getopts hmt:u: option;do
3233
case "${option}" in
3334
h) help && exit 0;;
3435
m) MAINTAIN_CONFIG_FILE=true;;
36+
t) SITE_TITLE=${OPTARG};;
3537
u) SITE_URL=${OPTARG};;
3638
esac
3739
done
@@ -59,6 +61,12 @@ fi
5961

6062
echo "extra:" >> mkdocs.yml
6163
cat zend-doc-theme-pt-br/assets.yml >> mkdocs.yml
64+
65+
# Add custom title to extra section
66+
if [ -n "${SITE_TITLE}" ]; then
67+
echo " site_title: '${SITE_TITLE}'" >> mkdocs.yml
68+
fi
69+
6270
echo "markdown_extensions:" >> mkdocs.yml
6371
echo " - markdown.extensions.codehilite:" >> mkdocs.yml
6472
echo " use_pygments: False" >> mkdocs.yml

theme/main.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<link rel="canonical" href="{{ page.canonical_url }}">{% endif %}
1111
<link rel="shortcut icon" href="{{ base_url }}/img/favicon.ico">
1212

13-
<title>{% if page.title %}{{ page.title }} - {% endif %}{{ config.site_name }}</title>
13+
<title>{% if page.title %}{{ page.title }} - {% endif %}{% if config.extra.site_title %}{{ config.extra.site_title }}{% else %}{{ config.site_name }}{% endif %}</title>
1414

1515
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
1616
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/font-awesome.min.css">

0 commit comments

Comments
 (0)