Skip to content

Conversation

@romaricpascal
Copy link
Member

Updates the blocks and variables not related to the header and footer so they follow the same conventions, with the relevant associated tests.

  • Add a container block wrapping the <div class="govuk-width-container"> element to replace the current main block
  • Move the main block so it only wraps the <main> tag
  • Deprecate beforeContent block in favour of a containerStart block for adding content at the start of the <div class="govuk-width-container"> element
  • Add a containerEnd block for adding content at the end of the <div class="govuk-width-container"> element
  • Add a containerAttributes variable to add attributes to the <div class="govuk-width-container"> element
  • Add a mainAttributes variable to add attributes to the <main> element
  • Depracate the skipLink block in favour of a govukSkipLink block

Closes #6535.

@romaricpascal romaricpascal changed the title Ensure page template options outside of header and footer follow conventions Make Page template options besides header and footer follow conventions Dec 5, 2025
@github-actions
Copy link

github-actions bot commented Dec 5, 2025

📋 Stats

No changes to any distributed file sizes!


Action run for c6be984

@romaricpascal romaricpascal force-pushed the page-template-follow-conventions branch from 6a83be7 to aa7d107 Compare December 5, 2025 19:05
@romaricpascal romaricpascal marked this pull request as ready for review December 5, 2025 19:13
@romaricpascal romaricpascal added this to the v6.0 milestone Dec 11, 2025
Copy link
Member

@querkmachine querkmachine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor formatting fixes but otherwise looks good to me

})

it('can have content injected before it using the beforeContent block', () => {
it('can be overridden using the main block', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it('can be overridden using the main block', () => {
it('can be overridden using the `main` block', () => {

Adding backticks around the block name for consistency with the other tests.

CHANGELOG.md Outdated
#### Use the `container` block instead of the `main` block to replace the width container

We've reduced the scope of the `main` block to only replace the `<main>` element,
rather than the whole `<div class="govuk-width-container"> element.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rather than the whole `<div class="govuk-width-container"> element.
rather than the whole `<div class="govuk-width-container">` element.

Missing a backtick here

…ner">` element

It'll replace the `main` block whose scope will be restricted to overriding
the `<main>` element.
The `main` name doesn't represent what the block was actually changing
(the `<div class="govuk-width-container">`), so there should be less
surprises for users now it overrides only `main`.
This aligns with the `<ELEMENT_NAME>Start` convention.

The legacy `beforeContent` block can still be used but
when both are present the new `containerStart` block takes precedence.
Add content at the end of the `<div class="govuk-width-container">` element,
allowing for example to close tags opened in the `containerStart` blocks.
For consistency with the other elements of the page template
Follows the convention that blocks replacing the components
have the same name as the macro for the component.
Follow our upgrade guide for the breaking change
@romaricpascal romaricpascal force-pushed the page-template-follow-conventions branch from aa7d107 to c6be984 Compare December 11, 2025 14:38
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-6538 December 11, 2025 14:39 Inactive
@romaricpascal romaricpascal merged commit 51d539b into main Dec 11, 2025
45 checks passed
@romaricpascal romaricpascal deleted the page-template-follow-conventions branch December 11, 2025 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ensure page templates blocks and variables align to conventions

4 participants