Skip to content

Commit c7ddbad

Browse files
authored
Add draft banner to GH Pages and PR preview builds (#4445)
This adds a draft banner to the top of Techniques and Understanding pages in builds run for GitHub Pages deploys or Netlify PR previews. The banner includes a link to the equivalent specific page under w3.org/WAI.
1 parent 2d76e8d commit c7ddbad

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

11ty/CustomLiquid.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ export class CustomLiquid extends Liquid {
158158
const prependedIncludes = ["header"];
159159
const appendedIncludes = ["wai-site-footer", "site-footer"];
160160

161+
// Include draft banner at top of informative pages for GH Pages builds and PR previews
162+
if (process.env.WCAG_MODE === "editors" || (process.env.COMMIT_REF && !process.env.WCAG_MODE))
163+
prependedIncludes.unshift("draft-banner");
164+
161165
if (isUnderstanding)
162166
prependedIncludes.push(
163167
isIndex ? "understanding/navigation-index" : "understanding/navigation"

_includes/draft-banner.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{%- comment -%}
2+
Banner shown only on builds of informative docs for GitHub Pages.
3+
{%- endcomment -%}
4+
{%- assign pubSlug = page.url | replace: "techniques", "Techniques" | replace: "understanding", "Understanding" | replace_last: ".html", "" -%}
5+
<section class="default-grid info" aria-label="Notice">
6+
<p class="inner">
7+
This is an unpublished editor’s draft that might include content that is not finalized.
8+
<a href="https://www.w3.org/WAI/WCAG{{ version }}{{ pubSlug }}">View the published version</a>
9+
</p>
10+
</section>

0 commit comments

Comments
 (0)