Skip to content

Commit

Permalink
Add script to fix H1s on Dokka-generated docs (#1460)
Browse files Browse the repository at this point in the history
* Add script to fix H1s on Dokka-generated docs

This is an SEO team request to make sure all pages have an H1.

* Verified script execution in development environment

---------

Co-authored-by: Claus Rørbech <claus.rorbech@mongodb.com>
  • Loading branch information
cbush and rorbech authored Jul 25, 2023
1 parent b6cea0f commit f383041
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tools/fix-h1s.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash -ex

usage() {
cat <<EOF
Usage: $0 <root-dokka-dir>
EOF
}

if [ "$#" -ne 1 ] ; then
usage
exit 1
fi

# Assume Dokka has been run
pushd $1

# Make the output SEO friendly by converting the "h2" title to the proper "h1".
# For Dokka, this is only an issue on the index page (apparently).
sed -i -e 's|<h2\(.*\)</h2>|<h1\1</h1>|' index.html
find . -iname "*.html-e" | xargs rm

popd
1 change: 1 addition & 0 deletions tools/publish_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ create_javadoc() {
echo "Creating JavaDoc/KDoc..."
cd $REALM_KOTLIN_PATH/packages
./gradlew dokkaHtmlMultiModule --info --stacktrace --no-daemon
../tools/fix-h1s.sh build/dokka/htmlMultiModule
cd $HERE
}

Expand Down

0 comments on commit f383041

Please sign in to comment.