Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lite Site: Remove data-react-helmet="true" attributes from all tags within the html <head> tag #12350

Draft
wants to merge 14 commits into
base: latest
Choose a base branch
from

Conversation

karinathomasbbc
Copy link
Contributor

@karinathomasbbc karinathomasbbc commented Jan 30, 2025

Overall changes

Removes the data-react-helmet attribute from the HTML head, to reduce page weight

Code changes

  • Created a litePageTransformer to remove data-react-helmet + tests
  • Invoke the new transformer for link, meta, script & title tags for lite pages

Testing

On Firefox with cache disabled

Page Type Live Local Before After Saving?
Homepage https://www.bbc.com/gahuza.lite http://localhost:7080/gahuza.lite?renderer_env=live 124.30 kB 122.18 kB 2.12 kB
Live Page https://www.bbc.com/gahuza/live/c2dl5y6dgrzt.lite http://localhost:7081/gahuza/live/c2dl5y6dgrzt.lite?renderer_env=live 118.9 kB 117.14 kB

Helpful Links

Add Links to useful resources related to this PR if applicable.

Coding Standards

Repository use guidelines

@karinathomasbbc karinathomasbbc self-assigned this Jan 31, 2025
@@ -31,7 +31,7 @@ import {
import parseAvRoute from '../parseAvRoute';

const removeLeadingSlash = (path: string) => path?.replace(/^\/+/g, '');
const removeAmp = (path: string) => path.split('.')[0];
const removeSuffix = (path: string) => path.split('.')[0];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should this perhaps be renamed to removePlatform instead?

@@ -257,9 +257,12 @@ const constructPageFetchUrl = ({
const variantPath = variant ? `/${variant}` : '';
const host = `http://${process.env.HOSTNAME || 'localhost'}`;
const port = process.env.PORT ? `:${process.env.PORT}` : '';
// pathname is the ID of the Live page without /service/live/, and supports both Tipo & CPS IDs

let liveId = id;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we need to add a comment here?

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.

1 participant