Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement : add sitemap/robot file for more SEO of the documentation by google/yahoo/bing indexer... #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ jobs:
run: |
set -x

echo "User-agent: *" >/tmp/robot.txt
echo "Disallow:" >>/tmp/robot.txt
echo "Sitemap: https://docs.haproxy.org/sitemap.xml" >>/tmp/robot.txt

echo "<?xml version="1.0" encoding="UTF-8"?>" >/tmp/sitemap.xml
echo "<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">" >>/tmp/sitemap.xml

for branch in $BRANCHES; do
printf "::group::Building %s\n" "$branch"
if [ "$branch" = "dev" ]; then
Expand All @@ -127,6 +134,13 @@ jobs:
rm -rf "docs/$branch/"
mkdir "docs/$branch/"

for n in "${files[@]}"
do
file=$(basename $n)
file=${file%*.txt}.html
echo "<url><loc>https://docs.haproxy.org/${$branch}/${file}</loc></url>" >>/tmp/sitemap.xml
done

env SOURCE_DATE_EPOCH="$LASTCHANGE" python3 dconv/dconv.py -g "$PWD/haproxy/" -o "$PWD/docs/$branch/" --base=.. ${files[@]}

git add "docs/$branch/"
Expand All @@ -136,6 +150,20 @@ jobs:

printf "::endgroup::\n"
done
echo "</urlset>" >>/tmp/sitemap.xml

cp /tmp/sitemap.xml docs/sitemap.xml
git add "docs/sitemap.xml"
if ! git diff --cached --quiet; then
git commit -m "Update sitemap.xml"
fi

cp /tmp/robot.txt docs/robot.txt
git add "docs/robot.txt"
if ! git diff --cached --quiet; then
git commit -m "Update robot.txt"
fi

- name: Push the changes.
run: |
git push