Skip to content

fix: prevent MC791596 banner migration for pages with no header#1758

Open
nicolaor wants to merge 3 commits intopnp:devfrom
MondayCoffee:3261_Fix_HomePage_PageTemplate
Open

fix: prevent MC791596 banner migration for pages with no header#1758
nicolaor wants to merge 3 commits intopnp:devfrom
MondayCoffee:3261_Fix_HomePage_PageTemplate

Conversation

@nicolaor
Copy link
Copy Markdown
Contributor

fix: prevent MC791596 banner migration for pages with no header

When saving a page with PageHeaderType.None, the legacy NoHeader() HTML
was written to LayoutWebpartsContent. SharePoint's MC791596 migration
detects this HTML on first browser open and injects a full-width Banner
web part into CanvasContent1, causing an unwanted header to appear on
pages created from the template.

Write string.Empty instead of NoHeader() to avoid triggering the migration.
Also skip the entire header persistence block for Home layout pages, which
do not support a banner header.

This might also fix #1718

When saving a page with PageHeaderType.None, the legacy NoHeader() HTML
was written to LayoutWebpartsContent. SharePoint's MC791596 migration
detects this HTML on first browser open and injects a full-width Banner
web part into CanvasContent1, causing an unwanted header to appear on
pages created from the template.

Write string.Empty instead of NoHeader() to avoid triggering the migration.
Also skip the entire header persistence block for Home layout pages, which
do not support a banner header.
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 81.15942% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.25%. Comparing base (63545f3) to head (416932a).
⚠️ Report is 2907 commits behind head on dev.

Files with missing lines Patch % Lines
...rePoint/Core/Internal/LegacyPrincipalManagement.cs 80.55% 4 Missing and 3 partials ⚠️
...k/PnP.Core/Model/SharePoint/Pages/Internal/Page.cs 81.81% 4 Missing and 2 partials ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1758      +/-   ##
==========================================
- Coverage   82.42%   81.25%   -1.17%     
==========================================
  Files         416      637     +221     
  Lines       28590    45388   +16798     
  Branches        0     4778    +4778     
==========================================
+ Hits        23565    36880   +13315     
- Misses       5025     7099    +2074     
- Partials        0     1409    +1409     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Adam-it
Copy link
Copy Markdown
Member

Adam-it commented Apr 16, 2026

Thanks for dropping a PR and helping us out. We will try to review it ASAP.
Also, in future please always ensure you first open up an issue, let use discuss and clarify on the solution first, and then open a PR once we agree on the change 👍

@nicolaor
Copy link
Copy Markdown
Contributor Author

@Adam-it sorry for that. I had already implemented this in our fork, so when I saw issue #1718 I thought it might be a good idea to just share the code we are using, without wasting too much time creating a separate issue for it ;-)

@Adam-it
Copy link
Copy Markdown
Member

Adam-it commented Apr 17, 2026

@Adam-it sorry for that. I had already implemented this in our fork, so when I saw issue #1718 I thought it might be a good idea to just share the code we are using, without wasting too much time creating a separate issue for it ;-)

Gotcha, thanks for sharing 👍.
Will try to go over it and try to merge it ASAP so other folks may use the best from the PnP package as well 🤩.

If you have more improvements/fixes done locally, please do share them as well 👍
Sharing is caring

@ejazhussain ejazhussain self-assigned this Apr 27, 2026
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.

Saving a page automatically adds a fixed-width section with a PageTitle component

4 participants