Add SEO post-processing for cloud wiki

This commit is contained in:
Carlos Polop
2026-03-11 21:25:52 +01:00
parent 40b954c021
commit 6a9b95fe96
5 changed files with 282 additions and 4 deletions
+18
View File
@@ -34,6 +34,15 @@ jobs:
# Build the mdBook
- name: Build mdBook
run: MDBOOK_BOOK__LANGUAGE=en mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && echo "" && echo "" && echo "Debug logs" && (cat hacktricks-preprocessor.log | tail -n 20) && exit 1)
- name: Post-process SEO artifacts
run: |
python3 scripts/seo_postprocess.py pages \
--book-dir ./book \
--site-url https://cloud.hacktricks.wiki \
--lang en \
--default-lang en \
--site-name "HackTricks Cloud"
- name: Push search index to hacktricks-searchindex repo
shell: bash
@@ -149,6 +158,15 @@ jobs:
- name: Sync to S3
run: aws s3 sync ./book s3://hacktricks-cloud/en --delete
- name: Upload root sitemap index
run: |
LANGS=$(aws s3api list-objects-v2 --bucket hacktricks-cloud --delimiter / --query 'CommonPrefixes[].Prefix' --output text | tr '\t' '\n' | sed 's:/$::' | grep -E '^[a-z]{2}$' | sort | paste -sd, -)
if [ -z "$LANGS" ]; then
LANGS="en"
fi
python3 scripts/seo_postprocess.py index --site-url https://cloud.hacktricks.wiki --languages "$LANGS" --output ./sitemap.xml
aws s3 cp ./sitemap.xml s3://hacktricks-cloud/sitemap.xml --content-type application/xml --cache-control max-age=300
- name: Upload root ads.txt
run: |
aws s3 cp ./ads.txt s3://hacktricks-cloud/ads.txt --content-type text/plain --cache-control max-age=300
+18
View File
@@ -254,6 +254,15 @@ jobs:
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
- name: Post-process SEO artifacts
run: |
python3 scripts/seo_postprocess.py pages \
--book-dir ./book \
--site-url https://cloud.hacktricks.wiki \
--lang "$BRANCH" \
--default-lang en \
--site-name "HackTricks Cloud"
# Sync the build to S3
- name: Sync to S3
@@ -265,3 +274,12 @@ jobs:
echo "Sync completed"
echo "Cat 3 files from the book"
find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat
- name: Refresh root sitemap index
run: |
LANGS=$(aws s3api list-objects-v2 --bucket hacktricks-cloud --delimiter / --query 'CommonPrefixes[].Prefix' --output text | tr '\t' '\n' | sed 's:/$::' | grep -E '^[a-z]{2}$' | sort | paste -sd, -)
if [ -z "$LANGS" ]; then
LANGS="en"
fi
python3 scripts/seo_postprocess.py index --site-url https://cloud.hacktricks.wiki --languages "$LANGS" --output ./sitemap.xml
aws s3 cp ./sitemap.xml s3://hacktricks-cloud/sitemap.xml --content-type application/xml --cache-control max-age=300