diff --git a/.github/workflows/validate-and-process.yml b/.github/workflows/validate-and-process.yml index 5bbd5bf..1fe96a4 100644 --- a/.github/workflows/validate-and-process.yml +++ b/.github/workflows/validate-and-process.yml @@ -289,7 +289,19 @@ jobs: if [[ "${BASE_URL}" =~ [^/]$ ]]; then BASE_URL="${BASE_URL}/" fi - + + # Pull register name/description for the viewer shell's and Open Graph + # meta tags, so link preview cards (which don't execute the SPA's JS) show + # something more specific than a generic hardcoded title. + REG_NAME="$(jq -r '.name // "OGC Building Blocks"' < "$REGISTER_FILE")" + REG_DESCRIPTION="$(jq -r '.description // .abstract // ""' < "$REGISTER_FILE")" + html_escape() { + sed -e 's/&/\&/g' -e 's/</\</g' -e 's/>/\>/g' -e 's/"/\"/g' + } + REG_NAME_HTML="$(printf '%s' "$REG_NAME" | html_escape)" + REG_DESCRIPTION_HTML="$(printf '%s' "$REG_DESCRIPTION" | html_escape)" + PAGE_URL="${{ steps.get-pages-url.outputs.result }}/${BASE_URL}" + cat << EOF > index.html <!DOCTYPE html> <html lang="en"> @@ -297,7 +309,15 @@ jobs: <meta charset="UTF-8" /> <link rel="icon" href="https://ogcincubator.github.io/bblocks-viewer/favicon.ico" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> - <title>OGC Location Building Blocks + ${REG_NAME_HTML} + + + + + + + +