Skip to content

MWPW-188278: Align head-loaded SSR flag with da-bacom pattern#960

Open
JasonHowellSlavin wants to merge 5 commits intostagefrom
ssr-flag
Open

MWPW-188278: Align head-loaded SSR flag with da-bacom pattern#960
JasonHowellSlavin wants to merge 5 commits intostagefrom
ssr-flag

Conversation

@JasonHowellSlavin
Copy link
Copy Markdown
Collaborator

  • Adds a meta element that will have it's content modified at the end of the script tag. When content is served with server side rendering from tokowaka, it will prevent any duplication that would occur should the script be run again, like when spoofing headers in the browser.

Resolves: MWPW-188278

Test URLs:

Verification Steps

  • Go to the test page
  • Inspect the <head> element, notice no new links
  • Go to the network tab
  • Click on "More network conditions"
  • Scroll down and enable "Custom User Agent"
  • Enter: "ChatGPT-User"
  • Reload
  • Inspect the <head>
  • Notice links
  • Ensure there is no link duplication

Additional testing example with video:

https://wiki.corp.adobe.com/spaces/WP4/pages/3747684013/Adding+Hreflang+Link+Block+Functionality#AddingHreflangLinkBlockFunctionality-Testing

Implementation doc

https://wiki.corp.adobe.com/spaces/WP4/pages/3747684013/Adding+Hreflang+Link+Block+Functionality

Add static meta head-loaded=false, derive ssrFlag from content, and set flagMeta content true at end of inline head script.

Made-with: Cursor
@aem-code-sync
Copy link
Copy Markdown

aem-code-sync Bot commented Apr 2, 2026

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

@aem-code-sync
Copy link
Copy Markdown

aem-code-sync Bot commented Apr 2, 2026

Page Scores Audits Google
📱 /creativecloud?martech=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI
🖥️ /creativecloud?martech=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

@milo-pr-merge-cc
Copy link
Copy Markdown

Skipped merging 960: MWPW-188278: Align head-loaded SSR flag with da-bacom pattern due to failing checks

1 similar comment
@milo-pr-merge-cc
Copy link
Copy Markdown

Skipped merging 960: MWPW-188278: Align head-loaded SSR flag with da-bacom pattern due to failing checks

Copy link
Copy Markdown
Collaborator

@nkthakur48 nkthakur48 left a comment

Choose a reason for hiding this comment

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

@JasonHowellSlavin Could you please have a look at review comments

Comment thread head.html
const isAllowedAgent = allowedAgents && allowedAgents.some((agent) => userAgentString.includes(agent.trim()));

const ssrFlag = document.querySelector('meta[name="head-loaded"]');
const flagMeta = document.querySelector('meta[name="head-loaded"]');
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Since flagMeta is always present in static HTML (due to L#2), the optional chaining here may not be required. It's fine to keep, but it should be consistent with the check on L#156

Comment thread head.html

const ssrFlag = document.querySelector('meta[name="head-loaded"]');
const flagMeta = document.querySelector('meta[name="head-loaded"]');
const ssrFlag = flagMeta?.content === 'true';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Minor: ssrFlag is now a boolean, but the name reads like an element reference. Variable names like isHeadLoaded or headAlreadyLoaded would be clearer

@milo-pr-merge-cc
Copy link
Copy Markdown

Skipped merging 960: MWPW-188278: Align head-loaded SSR flag with da-bacom pattern due to failing checks

1 similar comment
@milo-pr-merge-cc
Copy link
Copy Markdown

Skipped merging 960: MWPW-188278: Align head-loaded SSR flag with da-bacom pattern due to failing checks

@milo-pr-merge-cc
Copy link
Copy Markdown

Skipped merging 960: MWPW-188278: Align head-loaded SSR flag with da-bacom pattern due to failing checks

@milo-pr-merge-cc
Copy link
Copy Markdown

Skipped merging 960: MWPW-188278: Align head-loaded SSR flag with da-bacom pattern due to failing checks

@milo-pr-merge-cc
Copy link
Copy Markdown

Skipped merging 960: MWPW-188278: Align head-loaded SSR flag with da-bacom pattern due to failing checks

8 similar comments
@milo-pr-merge-cc
Copy link
Copy Markdown

Skipped merging 960: MWPW-188278: Align head-loaded SSR flag with da-bacom pattern due to failing checks

@milo-pr-merge-cc
Copy link
Copy Markdown

Skipped merging 960: MWPW-188278: Align head-loaded SSR flag with da-bacom pattern due to failing checks

@milo-pr-merge-cc
Copy link
Copy Markdown

Skipped merging 960: MWPW-188278: Align head-loaded SSR flag with da-bacom pattern due to failing checks

@milo-pr-merge-cc
Copy link
Copy Markdown

Skipped merging 960: MWPW-188278: Align head-loaded SSR flag with da-bacom pattern due to failing checks

@milo-pr-merge-cc
Copy link
Copy Markdown

Skipped merging 960: MWPW-188278: Align head-loaded SSR flag with da-bacom pattern due to failing checks

@milo-pr-merge-cc
Copy link
Copy Markdown

Skipped merging 960: MWPW-188278: Align head-loaded SSR flag with da-bacom pattern due to failing checks

@milo-pr-merge-cc
Copy link
Copy Markdown

Skipped merging 960: MWPW-188278: Align head-loaded SSR flag with da-bacom pattern due to failing checks

@milo-pr-merge-cc
Copy link
Copy Markdown

Skipped merging 960: MWPW-188278: Align head-loaded SSR flag with da-bacom pattern due to failing checks

@JasonHowellSlavin
Copy link
Copy Markdown
Collaborator Author

@nkthakur48 I am going to open some PRs with your comments above for the da-cc repo. Am I correct in understand that CC is fully migrated to DA and this repo is no longer used for the site? Or do I need to make the changes here as well?

@milo-pr-merge-cc
Copy link
Copy Markdown

Skipped merging 960: MWPW-188278: Align head-loaded SSR flag with da-bacom pattern due to failing checks

1 similar comment
@milo-pr-merge-cc
Copy link
Copy Markdown

Skipped merging 960: MWPW-188278: Align head-loaded SSR flag with da-bacom pattern due to failing checks

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.

2 participants