Skip to content

Commit 0df910a

Browse files
authored
Merge pull request #1 from ansibleguy/docs-infra
Docs infra
2 parents e3b9972 + 71fcc40 commit 0df910a

File tree

6 files changed

+129
-3
lines changed

6 files changed

+129
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docs/build/

docs/html_infra.sh

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#!/bin/bash
2+
3+
if [ -z "$1" ]
4+
then
5+
DEST_DIR='build'
6+
else
7+
DEST_DIR="$1"
8+
fi
9+
10+
set -euo pipefail
11+
12+
function log() {
13+
msg="$1"
14+
echo ''
15+
echo "### ${msg} ###"
16+
echo ''
17+
}
18+
19+
cd "$(dirname "$0")"
20+
21+
SRC_DIR="$(pwd)"
22+
23+
TS="$(date +%s)"
24+
TMP_DIR="/tmp/${TS}"
25+
mkdir -p "${TMP_DIR}"
26+
27+
VENV_BIN='/tmp/.ag-docs-venv/bin/activate'
28+
if [ -f "$VENV_BIN" ]
29+
then
30+
source "$VENV_BIN"
31+
fi
32+
33+
log 'BUILDING DOCS'
34+
export PYTHONWARNINGS='ignore'
35+
sphinx-build -b html source/ "${TMP_DIR}/" >/dev/null
36+
37+
log 'PATCHING METADATA'
38+
cp "${SRC_DIR}/meta/"* "${TMP_DIR}/"
39+
40+
HTML_META_SRC="<meta charset=\"utf-8\" />"
41+
HTML_META="${HTML_META_SRC}<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'self'; img-src 'self' https://files.oxl.at; style-src 'self' https://files.oxl.at 'unsafe-inline'; script-src 'self' https://files.oxl.at 'unsafe-inline' 'unsafe-eval'; connect-src 'self';\">"
42+
HTML_META="${HTML_META}<link rel=\"icon\" type=\"image/webp\" href=\"https://files.oxl.at/img/oxl3_sm.webp\">"
43+
HTML_META_EN="${HTML_META}" # <link rel=\"alternate\" href=\"https://docs.o-x-l.at\" hreflang=\"de\">
44+
# HTML_LOGO_LINK_SRC='href=".*Go to homepage"'
45+
# HTML_LOGO_LINK_EN='href="https://www.o-x-l.com" class="oxl-nav-logo" title="OXL IT Services Website"'
46+
HTML_TITLE_BAD_EN='Ansible Collection - Systemd documentation'
47+
HTML_TITLE_OK='Systemd Ansible Collection'
48+
HTML_LANG_NONE='<html'
49+
HTML_LANG_EN='html lang="en"'
50+
51+
cd "${TMP_DIR}/"
52+
53+
sed -i "s|$HTML_META_SRC|$HTML_META_EN|g" *.html
54+
sed -i "s|$HTML_META_SRC|$HTML_META_EN|g" */*.html
55+
# sed -i "s|$HTML_LOGO_LINK_SRC|$HTML_LOGO_LINK_EN|g" *.html
56+
# sed -i "s|$HTML_LOGO_LINK_SRC|$HTML_LOGO_LINK_EN|g" */*.html
57+
sed -i "s|$HTML_LANG_NONE|<$HTML_LANG_EN|g" *.html
58+
sed -i "s|$HTML_LANG_NONE|<$HTML_LANG_EN|g" */*.html
59+
sed -i "s|$HTML_TITLE_BAD_EN|$HTML_TITLE_OK|g" *.html
60+
sed -i "s|$HTML_TITLE_BAD_EN|$HTML_TITLE_OK|g" */*.html
61+
62+
log 'ACTIVATING'
63+
cd "$SRC_DIR"
64+
if [ -d "$DEST_DIR" ]
65+
then
66+
rm -r "$DEST_DIR"
67+
fi
68+
mkdir -p "${DEST_DIR}/"
69+
70+
mv "${TMP_DIR}/"* "${DEST_DIR}/"
71+
72+
touch "${DEST_DIR}/${TS}"
73+
74+
rm -rf "$TMP_DIR"
75+
76+
log 'FINISHED'

docs/meta/robots.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
User-agent: anthropic-ai
2+
Disallow: /
3+
4+
User-agent: Claude-Web
5+
Disallow: /
6+
7+
User-agent: ClaudeBot
8+
Disallow: /
9+
10+
User-agent: PerplexityBot
11+
Disallow: /
12+
13+
User-agent: CCBot
14+
Disallow: /
15+
16+
User-agent: Google-Extended
17+
Disallow: /
18+
19+
User-agent: GPTBot
20+
Disallow: /
21+
22+
User-agent: ChatGPT-User
23+
Disallow: /
24+
25+
User-agent: *
26+
Disallow:
27+
Sitemap: sitemap.xml

docs/meta/sitemap.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3+
<url><loc>https://systemd.ansibleguy.net/en/latest/</loc></url>
4+
5+
<url><loc>https://systemd.ansibleguy.net/en/latest/usage/install.html</loc></url>
6+
7+
<url><loc>https://systemd.ansibleguy.net/en/latest/modules/journal.html</loc></url>
8+
</urlset>

docs/source/conf.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
exclude_patterns = []
1111
html_theme = 'piccolo_theme'
1212
html_static_path = ['_static']
13-
html_logo = 'https://brand.systemd.io/assets/svg/systemd-dark.svg'
13+
html_logo = 'https://files.oxl.at/logos/systemd_dark.svg'
1414
html_favicon = '_static/img/favicon.png'
15-
html_css_files = ['css/main.css']
15+
html_js_files = ['https://files.oxl.at/js/feedback.js']
16+
html_css_files = ['css/main.css', 'https://files.oxl.at/css/feedback.css']
1617
master_doc = 'index'
1718
display_version = True
1819
sticky_navigation = True
@@ -21,6 +22,7 @@
2122
}
2223
html_theme_options = {
2324
'banner_text': '<a href="https://github.com/ansibleguy/collection_systemd">Repository on GitHub</a> | '
24-
'<a href="https://github.com/ansibleguy/collection_systemd/issues/new/choose">Report errors</a>'
25+
'<a href="https://github.com/ansibleguy/collection_systemd/issues/new/choose">Report Errors</a> | '
26+
'<a href="https://www.o-x-l.com">Get Support</a>'
2527
}
2628
html_short_title = 'Ansible Systemd'

docs/venv.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
cd "$(dirname "$0")"
6+
7+
VENV_PATH='/tmp/.ag-docs-venv'
8+
9+
python3 -m virtualenv "$VENV_PATH"
10+
source "${VENV_PATH}/bin/activate"
11+
12+
pip install -r requirements.txt >/dev/null

0 commit comments

Comments
 (0)