Skip to content

CI: check the head meta tags and the robots.txt Sitemap line in the pull request build #37

Description

@vharseko

#29 adds <meta name="description">, OpenGraph and Twitter card tags to every page (supplemental-ui/partials/head-meta.hbs, meta-description.hbs) and the Sitemap: line to robots.txt (site.robots in antora-playbook.yml). Nothing checks them automatically: they were verified once in a local build (285 pages, each tag exactly once, og:url missing only on 404.html). A later template edit that drops or duplicates a tag would still build green and deploy.

This was raised in the review of #29 (#29 (review)) and deferred: the pull request check it needs comes with #28 (.github/workflows/build.yml), so the check belongs there as a step rather than in a second workflow.

Proposal

Once #28 and #29 are merged, add a step to .github/workflows/build.yml that fails when:

  • build/site/robots.txt has no Sitemap: line, or its host differs from site.url in antora-playbook.yml (Antora writes site.robots verbatim, so today only a comment keeps the two in sync);
  • a generated page, other than the redirect pages (http-equiv="refresh"), does not carry exactly one each of <meta name="description", og:title, og:description, og:image, twitter:card;
  • og:url is missing on any page but 404.html.

The review suggested a starting point for the tag loop:

grep -qx 'Sitemap: https://doc.openidentityplatform.org/sitemap.xml' build/site/robots.txt
fail=0
while IFS= read -r f; do
  grep -q 'http-equiv="refresh"' "$f" && continue
  for tag in '<meta name="description"' '<meta property="og:title"' '<meta property="og:description"' '<meta property="og:image"' '<meta name="twitter:card"'; do
    n=$(grep -cF "$tag" "$f" || true)
    [ "$n" -eq 1 ] || { echo "$f: $n x $tag"; fail=1; }
  done
done < <(find build/site -name '*.html')
exit $fail

The API docs copied into build/site by npm run copyApiDocs must be left out, as the link check of #28 does.

Done when

Removing any of the tags from head-meta.hbs, or the Sitemap: line from the playbook, turns the Build check red.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ciContinuous integration, build and publish workflowsdocumentationImprovements or additions to documentationenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions