Skip to content

Commit

Permalink
Merge pull request #964 from web-illinois/bugfix/trubach/issue-957-un…
Browse files Browse the repository at this point in the history
…published-pages-give-no-indication-to-the-user-viewing-the-page

Add unpublished class to main tag to fix issue #957
  • Loading branch information
trubach authored Nov 7, 2023
2 parents 18d4fae + eea83d5 commit 6a4371c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scss/illinois-framework/_region.content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@


/* Show message on content that is unpublished */
article.is-unpublished:before {
content: "This page is not published and will not be visible to unauthenticated users";
article.is-unpublished:before,
main.is-unpublished:before {
content: "This page is unpublished and is only visible to site editors";
text-align: center;
padding: 2em;
margin-bottom: 2em;
Expand Down
4 changes: 4 additions & 0 deletions templates/layout/page--content-page.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@
{# if a side navigation exists and /'latest' is not in the url then spoof the content region #}
{% if node.field_sidebar.0.value == "sidebar" and '/latest' not in url|render|render %}

{# Add an is-unpublished class to main tag if the node is unpublished #}
{% set unpublished = [not node.isPublished() ? 'is-unpublished'] %}
{% set mainClasses = mainClasses|merge(unpublished) %}

<a name="main-content" aria-label="Start of content region"></a>
<main{{ attributes.addClass(mainClasses) }} role="main">
<div class="il-content-with-section-nav section-nav-example">
Expand Down

0 comments on commit 6a4371c

Please sign in to comment.