Skip to content

Commit f383041

Browse files
cbushrorbech
andauthored
Add script to fix H1s on Dokka-generated docs (#1460)
* 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 <[email protected]>
1 parent b6cea0f commit f383041

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

tools/fix-h1s.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash -ex
2+
3+
usage() {
4+
cat <<EOF
5+
Usage: $0 <root-dokka-dir>
6+
EOF
7+
}
8+
9+
if [ "$#" -ne 1 ] ; then
10+
usage
11+
exit 1
12+
fi
13+
14+
# Assume Dokka has been run
15+
pushd $1
16+
17+
# Make the output SEO friendly by converting the "h2" title to the proper "h1".
18+
# For Dokka, this is only an issue on the index page (apparently).
19+
sed -i -e 's|<h2\(.*\)</h2>|<h1\1</h1>|' index.html
20+
find . -iname "*.html-e" | xargs rm
21+
22+
popd

tools/publish_release.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ create_javadoc() {
108108
echo "Creating JavaDoc/KDoc..."
109109
cd $REALM_KOTLIN_PATH/packages
110110
./gradlew dokkaHtmlMultiModule --info --stacktrace --no-daemon
111+
../tools/fix-h1s.sh build/dokka/htmlMultiModule
111112
cd $HERE
112113
}
113114

0 commit comments

Comments
 (0)