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

Stop landing pages from rendering at the dynamic route #11354

Merged
merged 7 commits into from
Nov 5, 2024

Conversation

rcantin-w
Copy link
Contributor

@rcantin-w rcantin-w commented Oct 30, 2024

What does this change?

#11341

Currently in prod, we render all pages tagged with the correct section at /[section]/[uid], which means that the landing page (e.g. 'visit-us'), which is tagged with the 'visit-us' section, also renders there: https://wellcomecollection.org/visit-us/visit-us

We never link to that URL, but I'm thinking we also don't want to allow it, so this covers that.

We also simplify the linkResolver logic and ensure all scenarios consider whether or not the linked page is a landing page.

How to test

Run locally and try all landing pages, like http://localhost:3000/visit-us/visit-us (or get-involved, or about-us)
Make sure it doesn't break anything that should work though.
http://localhost:3000/pages/visit-us
http://localhost:3000/pages/accessibility
http://localhost:3000/visit-us/visit-us
etc.

I'd also say to double check the Prismic preview still works since we've amended the linkResolver.

How can we measure success?

Just less confusion and clearer rules for Page paths.

Have we considered potential risks?

N/A if we test right and tests pass.

Copy link

github-actions bot commented Oct 30, 2024

Size Change: -36 B (0%)

Total Size: 982 kB

Filename Size Change
content/webapp/.next/static/chunks/pages/_app-cd8ad9b30ff4f4d0.js 0 B -111 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/events/[eventId]-187554644327b2e3.js 0 B -9.12 kB (removed) 🏆
identity/webapp/.next/static/chunks/pages/_app-22409d725935c787.js 0 B -104 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/_app-fcdfb74ed578a996.js 111 kB +111 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/events/[eventId]-7c33b3b242a2f6a9.js 9.11 kB +9.11 kB (new file) 🆕
identity/webapp/.next/static/chunks/pages/_app-51d2c49c5f20ec83.js 104 kB +104 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size
content/webapp/.next/static/chunks/00a8a139.976ae5fd9989bf10.js 59 kB
content/webapp/.next/static/chunks/132.a3e6dccd1c7be577.js 4.82 kB
content/webapp/.next/static/chunks/1349.d2a91366cd45a4ca.js 1.13 kB
content/webapp/.next/static/chunks/1624.078f48c0e02f531b.js 269 B
content/webapp/.next/static/chunks/1747-9b37837e7a655501.js 6.96 kB
content/webapp/.next/static/chunks/2223.13e51946be4f0995.js 1.8 kB
content/webapp/.next/static/chunks/2224.698cff5ecfb4c28b.js 1.43 kB
content/webapp/.next/static/chunks/2545.c2b990ec5d9479b8.js 1.36 kB
content/webapp/.next/static/chunks/2568.b1076f5e01039efd.js 802 B
content/webapp/.next/static/chunks/2630-4bf3a02ad19c8ede.js 4.46 kB
content/webapp/.next/static/chunks/267-d39fe4d3f0f27696.js 3.67 kB
content/webapp/.next/static/chunks/286.b066630328a98bd8.js 20.8 kB
content/webapp/.next/static/chunks/3.118acbbc2ae9c2bd.js 711 B
content/webapp/.next/static/chunks/3199.4ed9de84fa34a4be.js 439 B
content/webapp/.next/static/chunks/3419.35e7d06626e8c6d0.js 420 B
content/webapp/.next/static/chunks/3420-7e0cf6c9a569a227.js 3.87 kB
content/webapp/.next/static/chunks/3471-2d163d9eb60afaf9.js 2.77 kB
content/webapp/.next/static/chunks/3627.3684abdbe8510420.js 1.77 kB
content/webapp/.next/static/chunks/382-ca57e688a4545109.js 3.07 kB
content/webapp/.next/static/chunks/4133-d91fe1f8fc0e2368.js 3.76 kB
content/webapp/.next/static/chunks/4468.bdc27fdcaba7eeb6.js 6.42 kB
content/webapp/.next/static/chunks/4537-aed562e9224ed8f2.js 4.22 kB
content/webapp/.next/static/chunks/4769-8a82adb1709af6d7.js 4.82 kB
content/webapp/.next/static/chunks/4825-4df3e43759acfe8c.js 7.76 kB
content/webapp/.next/static/chunks/4962-1a876f84ea228198.js 12.3 kB
content/webapp/.next/static/chunks/5006-e89ff8af75151368.js 7.15 kB
content/webapp/.next/static/chunks/5048.c1216d2909771efa.js 2.87 kB
content/webapp/.next/static/chunks/5286-de436fa2a0f41643.js 3.27 kB
content/webapp/.next/static/chunks/5292-c9184bd963da2e99.js 2.83 kB
content/webapp/.next/static/chunks/5389.d762d43fb2d0a421.js 1.7 kB
content/webapp/.next/static/chunks/5435-4268f265804ebf5e.js 4.6 kB
content/webapp/.next/static/chunks/5768-699dd21166035c67.js 3.18 kB
content/webapp/.next/static/chunks/5843-e7a3b6f6cdcea870.js 3.09 kB
content/webapp/.next/static/chunks/6207.faaccc5f80a44f7a.js 268 B
content/webapp/.next/static/chunks/6318.9b79dafa4a83ab14.js 2.29 kB
content/webapp/.next/static/chunks/6501.9d55230c8b2317c4.js 1.36 kB
content/webapp/.next/static/chunks/6577-effbaab7dae5448b.js 3.52 kB
content/webapp/.next/static/chunks/6862-6cb73d49b8e04c30.js 4.47 kB
content/webapp/.next/static/chunks/6879.76da889a24c486ba.js 2.6 kB
content/webapp/.next/static/chunks/7107-eecda3d84c2ca297.js 34.1 kB
content/webapp/.next/static/chunks/722-5fab1f60706c5d9d.js 3.25 kB
content/webapp/.next/static/chunks/7414-03438ef5466cad65.js 6 kB
content/webapp/.next/static/chunks/7440.a550caa8c61a39a3.js 2.85 kB
content/webapp/.next/static/chunks/7603-2c1fce9be705b72d.js 3.26 kB
content/webapp/.next/static/chunks/7888.8e9fcf84cd7c25ed.js 5.29 kB
content/webapp/.next/static/chunks/8069-d320306037284663.js 17.4 kB
content/webapp/.next/static/chunks/8189-461a5e1315036809.js 3.45 kB
content/webapp/.next/static/chunks/8348.7aa3dc55a5cec72b.js 1.26 kB
content/webapp/.next/static/chunks/9042-292aa8c7a960ba0a.js 5.33 kB
content/webapp/.next/static/chunks/9049-a63f6fa100834eba.js 3.63 kB
content/webapp/.next/static/chunks/908.c3283f73c6e55bbf.js 1.79 kB
content/webapp/.next/static/chunks/9519-6080bd680ba0d28a.js 6.16 kB
content/webapp/.next/static/chunks/9590.2d7b95171d8d0866.js 579 B
content/webapp/.next/static/chunks/9680-61cdea884fd997d9.js 3.13 kB
content/webapp/.next/static/chunks/9778-7a9dca488eda648b.js 3.06 kB
content/webapp/.next/static/chunks/9950.02e3834265565be8.js 1.13 kB
content/webapp/.next/static/chunks/framework-cd51c6317946e9aa.js 45.2 kB
content/webapp/.next/static/chunks/main-978dba4ddde48128.js 30.7 kB
content/webapp/.next/static/chunks/pages/_error-4ae94352bfd58ed4.js 335 B
content/webapp/.next/static/chunks/pages/[uid]-daa54634d1052e14.js 1.97 kB
content/webapp/.next/static/chunks/pages/404-9b6af81752f83cf9.js 263 B
content/webapp/.next/static/chunks/pages/500-7bf98e2f0d70a0db.js 262 B
content/webapp/.next/static/chunks/pages/about-us-ab121ac90c3fe1d4.js 1.97 kB
content/webapp/.next/static/chunks/pages/about-us/[uid]-509b7d82c9bdbd34.js 1.97 kB
content/webapp/.next/static/chunks/pages/books-5337fdd5f8527fa6.js 2.99 kB
content/webapp/.next/static/chunks/pages/books/[bookId]-416cfafb224551c8.js 4.21 kB
content/webapp/.next/static/chunks/pages/collections-33584499bc251354.js 2.38 kB
content/webapp/.next/static/chunks/pages/collections/[uid]-e35ec1d58435aa91.js 1.97 kB
content/webapp/.next/static/chunks/pages/concepts/[conceptId]-af7bff21125eb4c7.js 4.39 kB
content/webapp/.next/static/chunks/pages/cookie-policy-d38036ca95595d73.js 6.3 kB
content/webapp/.next/static/chunks/pages/event-series/[eventSeriesId]-f068b8cf78012474.js 3.29 kB
content/webapp/.next/static/chunks/pages/events-5f00a9cf8b5f39e9.js 3.1 kB
content/webapp/.next/static/chunks/pages/events/[eventId]/visual-stories-e361b663cc5ee385.js 304 B
content/webapp/.next/static/chunks/pages/exhibitions-8540408493be5658.js 3.34 kB
content/webapp/.next/static/chunks/pages/exhibitions/[exhibitionId]-cb28b1c18571b7a5.js 4.03 kB
content/webapp/.next/static/chunks/pages/exhibitions/[exhibitionId]/visual-stories-b0cfcf472928d278.js 304 B
content/webapp/.next/static/chunks/pages/get-involved-3713e5ba8958a38f.js 1.97 kB
content/webapp/.next/static/chunks/pages/get-involved/[uid]-d15a7b8676a28065.js 1.98 kB
content/webapp/.next/static/chunks/pages/guides/[guideId]-05cc9a1534886857.js 2.28 kB
content/webapp/.next/static/chunks/pages/guides/exhibitions-c1c86bdb4c433091.js 3.57 kB
content/webapp/.next/static/chunks/pages/guides/exhibitions/[id]-6b6cb70b570043cc.js 3.53 kB
content/webapp/.next/static/chunks/pages/guides/exhibitions/[id]/[type]-5f83709f575851fa.js 7.31 kB
content/webapp/.next/static/chunks/pages/guides/exhibitions/[id]/[type]/[stop]-1e99a121a4520af9.js 3.9 kB
content/webapp/.next/static/chunks/pages/index-15f756c44dd891fa.js 2.01 kB
content/webapp/.next/static/chunks/pages/newsletter-9e19b75aab9d58f4.js 2.39 kB
content/webapp/.next/static/chunks/pages/pages/[pageId]-c564409324b8e843.js 1.94 kB
content/webapp/.next/static/chunks/pages/projects/[projectId]-b954900674b25a9b.js 2.26 kB
content/webapp/.next/static/chunks/pages/search-dd2b452f635fb0c0.js 5.34 kB
content/webapp/.next/static/chunks/pages/search/events-147e6a873dcee57a.js 1.52 kB
content/webapp/.next/static/chunks/pages/search/images-c368bfeff46d5e5c.js 2.16 kB
content/webapp/.next/static/chunks/pages/search/stories-6845c80b54516d6a.js 3.26 kB
content/webapp/.next/static/chunks/pages/search/works-b4853ff80a576e18.js 4.4 kB
content/webapp/.next/static/chunks/pages/seasons/[seasonId]-005659ad17a2f569.js 3.94 kB
content/webapp/.next/static/chunks/pages/series/[seriesId]-8fa01d36e6429120.js 5.55 kB
content/webapp/.next/static/chunks/pages/slice-simulator-29a0ef9211652363.js 8.48 kB
content/webapp/.next/static/chunks/pages/stories-f2274452dd7b26e3.js 3.64 kB
content/webapp/.next/static/chunks/pages/stories/[articleId]-a32d859828a8385a.js 7.15 kB
content/webapp/.next/static/chunks/pages/visit-us-f4d0822b45f64bf6.js 2.29 kB
content/webapp/.next/static/chunks/pages/visit-us/[uid]-4106d1c9bb5d230b.js 1.98 kB
content/webapp/.next/static/chunks/pages/visual-stories/[visualStoryId]-13d261b44455da8c.js 242 B
content/webapp/.next/static/chunks/pages/whats-on-425c28a6ef16454b.js 220 B
content/webapp/.next/static/chunks/pages/whats-on/[period]-52becb68c10c131c.js 288 B
content/webapp/.next/static/chunks/pages/works/[workId]-937bbe2b27f85996.js 23.7 kB
content/webapp/.next/static/chunks/pages/works/[workId]/download-ccf37e6191bb73ec.js 3.06 kB
content/webapp/.next/static/chunks/pages/works/[workId]/images-8a8f2334078310e8.js 699 B
content/webapp/.next/static/chunks/pages/works/[workId]/items-55cc335245248060.js 2.4 kB
content/webapp/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js 31.1 kB
content/webapp/.next/static/chunks/webpack-68508982bb4acbb9.js 2.33 kB
identity/webapp/.next/static/chunks/286.b94e91b70e38ea49.js 20.7 kB
identity/webapp/.next/static/chunks/374.94537fd117195c86.js 2.47 kB
identity/webapp/.next/static/chunks/432.fa29da5acdb8e0b1.js 744 B
identity/webapp/.next/static/chunks/442-f1af16c3993c320a.js 8.96 kB
identity/webapp/.next/static/chunks/644-2ca73088ad8338ab.js 16.4 kB
identity/webapp/.next/static/chunks/framework-b330de622121c9cc.js 45.2 kB
identity/webapp/.next/static/chunks/main-d973a3979032d64a.js 32.2 kB
identity/webapp/.next/static/chunks/pages/_error-8e82953fa241027d.js 1.42 kB
identity/webapp/.next/static/chunks/pages/delete-requested-5e24da8710b594ff.js 3.21 kB
identity/webapp/.next/static/chunks/pages/error-2784191c63901541.js 1.7 kB
identity/webapp/.next/static/chunks/pages/index-44b48653e661ac63.js 11.9 kB
identity/webapp/.next/static/chunks/pages/registration-0736636262fc3578.js 4.13 kB
identity/webapp/.next/static/chunks/pages/success-1230b17dd14dc2d1.js 3.29 kB
identity/webapp/.next/static/chunks/pages/validated-962f79b0e82f2836.js 3.37 kB
identity/webapp/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js 31.1 kB
identity/webapp/.next/static/chunks/webpack-d9d97d637ba6ec7a.js 1.82 kB

compressed-size-action

@rcantin-w rcantin-w marked this pull request as ready for review October 30, 2024 13:20
@rcantin-w rcantin-w requested a review from a team as a code owner October 30, 2024 13:20
@rcantin-w
Copy link
Contributor Author

@rcantin-w rcantin-w marked this pull request as draft October 30, 2024 14:21
@@ -185,14 +185,11 @@ const EventPage: NextPage<EventProps> = ({
url: '/events',
text: 'Events',
},
...event.series.map(series => {
console.log(series);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just removed this log (I could see some logs in Kibana, unsure which ones they are but thought I'd remove the ones we don't need).

@@ -84,9 +84,7 @@ const stageApiToggleCookie = createCookie({
value: 'true',
});

// TODO: context.addCookies should run for the first test of a suite (even on beforeAll/beforeEach)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This TODO is 3 yrs old, and we don't want all scenarios to have cookies added, so removing.

Comment on lines +113 to +115
const isLandingPageRenderingAsSubPage =
pageId === siteSection &&
context.resolvedUrl.indexOf(`/${siteSection}/${pageId}`) === 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.

A little bit verbose to my taste, will take ideas on cleverer ways of checking this.

@rcantin-w rcantin-w marked this pull request as ready for review October 31, 2024 10:36

return `${docSiteSection ? '/' + docSiteSection : ''}/${uid}`;
// Prismic previews come through here.
if ('tags' in doc) {
Copy link
Contributor

Choose a reason for hiding this comment

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

does this mean that if there is a sitesection tag, it would take precedence over doc.siteSection – and if so is that ok?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess so yes, and if so it should still be the correct siteSection, so I'd say it's ok!

@rcantin-w rcantin-w merged commit 04068cf into main Nov 5, 2024
8 checks passed
@rcantin-w rcantin-w deleted the stop-landing-rendering branch November 5, 2024 10:40
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.

3 participants