wellcomecollection / wellcomecollection.org

đŸĒŸ Wellcome Collection's website and services that support it
https://wellcomecollection.org
MIT License
37 stars 5 forks source link

Make Cookie Policy a Prismic page with inserted content #10890

Closed rcantin-w closed 1 month ago

rcantin-w commented 1 month ago

Who is this for?

Ease of maintenance of the cookie policy page; taking it off dev hands.

10891

What is it doing for them?

[!NOTE] A quick reminder, we used to have a Table slice, but it was not intuitive at all to use (pipe delimited CSV style) and unused, so we removed it and I don't think this warrants bringing it back. Therefore, the Cookie Policy page had to be hard-coded as it had tables throughout the body. We'd like to not have to deploy for any copy change and this is a suggestion in how we could do that. If it does not fit our standards or we don't want to open the door to hacks, please flag so!

I created a Prismic page called Cookie Policy (editable here). That page is made up of Text slice, a new one being created as a placeholder for specific tables we want to display.

Screenshot 2024-05-24 at 16 12 28

I then modified our pages/cookie-policy.tsx file to fetch the data of that page. In that file, I then find the index of the placeholders and replace them with the table containing data of the same name.

I also left the policyUpdatedDate line hard-coded, as I believe deploying changes to the value of that date is needed to re-trigger consent requesting from our users.

One TODO has to do with untransformedBody vs transformedBody as I only use the former at the moment, but I believe @gestchild is currently working on tidying that up as part of the Slice Machine work having been released. The other TODO is around what other data we think we should get from Prismic, should we like this solution enough (e.g. metadata)

github-actions[bot] commented 1 month ago

Size Change: +154 B (+0.02%)

Total Size: 971 kB

Filename Size Change
content/webapp/.next/static/chunks/pages/_app-e062c47b18476179.js 0 B -111 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/cookie-policy-387baba12b7c55a6.js 0 B -6.31 kB (removed) 🏆
identity/webapp/.next/static/chunks/pages/_app-ce3585df54ed5703.js 0 B -99.9 kB (removed) 🏆
content/webapp/.next/static/chunks/pages/_app-16feea97c6433ffb.js 111 kB +111 kB (new file) 🆕
content/webapp/.next/static/chunks/pages/cookie-policy-d5851774f66ee5ce.js 6.42 kB +6.42 kB (new file) 🆕
identity/webapp/.next/static/chunks/pages/_app-10e98261be544478.js 99.9 kB +99.9 kB (new file) 🆕
ℹī¸ View Unchanged | Filename | Size | | :--- | :---: | | `content/webapp/.next/static/chunks/00a8a139.d1615490c6d9d990.js` | 59 kB | | `content/webapp/.next/static/chunks/1002-f40813c0339a6ab0.js` | 4.22 kB | | `content/webapp/.next/static/chunks/1064.5302fc0ceb6abf15.js` | 1.07 kB | | `content/webapp/.next/static/chunks/1132.931dd34613d06b7e.js` | 1.18 kB | | `content/webapp/.next/static/chunks/1135-dec1d2acf9414ba1.js` | 3.06 kB | | `content/webapp/.next/static/chunks/122-a648ab5ef2752390.js` | 2.67 kB | | `content/webapp/.next/static/chunks/1383.e50da80def2c9de0.js` | 1.06 kB | | `content/webapp/.next/static/chunks/1386-d4229c7c4a075f04.js` | 4.6 kB | | `content/webapp/.next/static/chunks/1651.12be858e737999ac.js` | 2.3 kB | | `content/webapp/.next/static/chunks/1712.032b8978b43b8e2d.js` | 1.2 kB | | `content/webapp/.next/static/chunks/1747-b0eb98abf95be996.js` | 6.17 kB | | `content/webapp/.next/static/chunks/196.f2b3d8e646d8eb40.js` | 3.04 kB | | `content/webapp/.next/static/chunks/2059-2279f792b8ce5e5b.js` | 2.67 kB | | `content/webapp/.next/static/chunks/2327.b502af087145f0bd.js` | 1.06 kB | | `content/webapp/.next/static/chunks/2596.f12a7f06b06577a2.js` | 1.26 kB | | `content/webapp/.next/static/chunks/2787-2d2b57459396060e.js` | 2.24 kB | | `content/webapp/.next/static/chunks/2889.a2ffc850cd6682c4.js` | 1.82 kB | | `content/webapp/.next/static/chunks/3021.911fda038d679160.js` | 2.37 kB | | `content/webapp/.next/static/chunks/3026.2499b4a557487bca.js` | 1.19 kB | | `content/webapp/.next/static/chunks/3138.0e1369679b800355.js` | 1.06 kB | | `content/webapp/.next/static/chunks/344-4e808891c4865ae3.js` | 2.84 kB | | `content/webapp/.next/static/chunks/3615-e4b199f75eb7244d.js` | 6.93 kB | | `content/webapp/.next/static/chunks/4407.0268b749df25dcf1.js` | 2.15 kB | | `content/webapp/.next/static/chunks/4479.5028e36e1fa8b7ea.js` | 1.26 kB | | `content/webapp/.next/static/chunks/4494.ab7c131e574eedff.js` | 1.07 kB | | `content/webapp/.next/static/chunks/4537-2ef42c58094653e6.js` | 19 kB | | `content/webapp/.next/static/chunks/466-ec82af66b815c291.js` | 2.67 kB | | `content/webapp/.next/static/chunks/4696.81e3adfbf875bf27.js` | 1.25 kB | | `content/webapp/.next/static/chunks/4732.28e654702188fa9b.js` | 1.24 kB | | `content/webapp/.next/static/chunks/4825-0da3332c92191dfb.js` | 7.78 kB | | `content/webapp/.next/static/chunks/4962-68bb7d1d02721b2a.js` | 12.3 kB | | `content/webapp/.next/static/chunks/5623.9a3338ec971ad33c.js` | 1.17 kB | | `content/webapp/.next/static/chunks/5637-d010b2f2cebc3449.js` | 20.3 kB | | `content/webapp/.next/static/chunks/6017-9afe7171c14b0989.js` | 3.53 kB | | `content/webapp/.next/static/chunks/6204-1aca3c1b0c7ed16a.js` | 3.81 kB | | `content/webapp/.next/static/chunks/6495.fa9e93c937b98b0a.js` | 1.06 kB | | `content/webapp/.next/static/chunks/6577-effbaab7dae5448b.js` | 3.51 kB | | `content/webapp/.next/static/chunks/6677.859ea72e9d7bdd12.js` | 19.9 kB | | `content/webapp/.next/static/chunks/7020-f81614250a2916db.js` | 2.23 kB | | `content/webapp/.next/static/chunks/7107-690d46121f0c6582.js` | 26.7 kB | | `content/webapp/.next/static/chunks/7409.780a867780690d01.js` | 1.39 kB | | `content/webapp/.next/static/chunks/7635-0322c8fb1b511131.js` | 3.52 kB | | `content/webapp/.next/static/chunks/7663.3ddbf7651613669e.js` | 1.19 kB | | `content/webapp/.next/static/chunks/7888-b390293f392e24f5.js` | 4.66 kB | | `content/webapp/.next/static/chunks/8060.895d4f706a719810.js` | 2.44 kB | | `content/webapp/.next/static/chunks/8540-6a7ad68b578a97d3.js` | 3.35 kB | | `content/webapp/.next/static/chunks/8651-cd800b1313c083e8.js` | 3.12 kB | | `content/webapp/.next/static/chunks/8850-152982a0bc3131dc.js` | 2.67 kB | | `content/webapp/.next/static/chunks/8886-ee64f476c336ec00.js` | 4.42 kB | | `content/webapp/.next/static/chunks/9049-6036daa1efd8a05f.js` | 3.47 kB | | `content/webapp/.next/static/chunks/9065-ebbd9fb91fcbd328.js` | 5.15 kB | | `content/webapp/.next/static/chunks/9264.303c1100298f17f5.js` | 900 B | | `content/webapp/.next/static/chunks/9519-9c09f45756b9ba86.js` | 8.01 kB | | `content/webapp/.next/static/chunks/9574-906d1fcbacfd8c3a.js` | 5.69 kB | | `content/webapp/.next/static/chunks/9685.6d2891018aabc9a8.js` | 1.06 kB | | `content/webapp/.next/static/chunks/9704-cabf3fa83d4504e4.js` | 4.55 kB | | `content/webapp/.next/static/chunks/framework-f29e48ae95cae5a3.js` | 45.2 kB | | `content/webapp/.next/static/chunks/main-978dba4ddde48128.js` | 30.8 kB | | `content/webapp/.next/static/chunks/pages/_error-54ad671c1257cec3.js` | 335 B | | `content/webapp/.next/static/chunks/pages/404-9e69cf17ffb062d5.js` | 261 B | | `content/webapp/.next/static/chunks/pages/500-889eb9240c0e2c83.js` | 260 B | | `content/webapp/.next/static/chunks/pages/articles-7b945fef3e12000f.js` | 3.26 kB | | `content/webapp/.next/static/chunks/pages/articles/[articleId]-d8b89582e99c0666.js` | 4.45 kB | | `content/webapp/.next/static/chunks/pages/books-285e3d2184d47839.js` | 3.28 kB | | `content/webapp/.next/static/chunks/pages/books/[bookId]-e76df8dcdd5b9da9.js` | 2.23 kB | | `content/webapp/.next/static/chunks/pages/collections-e89533035c4abaf9.js` | 3.02 kB | | `content/webapp/.next/static/chunks/pages/concepts/[conceptId]-93fa544530d3419e.js` | 4.58 kB | | `content/webapp/.next/static/chunks/pages/covid-welcome-back-2ddf3e722a9b7b1d.js` | 12.2 kB | | `content/webapp/.next/static/chunks/pages/event-series/[eventSeriesId]-0d666f86d1bb7e43.js` | 4.15 kB | | `content/webapp/.next/static/chunks/pages/events-ba0357d5cf6dd581.js` | 3.38 kB | | `content/webapp/.next/static/chunks/pages/events/[eventId]-1b7bb94ae8193ba6.js` | 8.22 kB | | `content/webapp/.next/static/chunks/pages/events/[eventId]/visual-stories-a562e28c3d86df5f.js` | 302 B | | `content/webapp/.next/static/chunks/pages/exhibitions-be9348c6f9e06d9e.js` | 3.57 kB | | `content/webapp/.next/static/chunks/pages/exhibitions/[exhibitionId]-c82e4c512ce00030.js` | 4.09 kB | | `content/webapp/.next/static/chunks/pages/exhibitions/[exhibitionId]/visual-stories-9b0c40729a2f8cf8.js` | 305 B | | `content/webapp/.next/static/chunks/pages/guides/[pageId]-974abd3b48c23df7.js` | 2.92 kB | | `content/webapp/.next/static/chunks/pages/guides/exhibitions-a69cab2dbfe5311b.js` | 4.28 kB | | `content/webapp/.next/static/chunks/pages/guides/exhibitions/[id]-ed3d097500ef0447.js` | 4.66 kB | | `content/webapp/.next/static/chunks/pages/guides/exhibitions/[id]/[type]-b072e4cecdf1df99.js` | 4.47 kB | | `content/webapp/.next/static/chunks/pages/index-ff00b16bc62717ba.js` | 2.45 kB | | `content/webapp/.next/static/chunks/pages/newsletter-5516f4c20808a1d8.js` | 2.39 kB | | `content/webapp/.next/static/chunks/pages/pages/[pageId]-e20d104a8e57f8ac.js` | 2.89 kB | | `content/webapp/.next/static/chunks/pages/projects/[pageId]-f31848076e8e2e60.js` | 2.92 kB | | `content/webapp/.next/static/chunks/pages/search-35bfa35cf0ce5f5a.js` | 5.38 kB | | `content/webapp/.next/static/chunks/pages/search/events-5877b74d3cae53b2.js` | 1.33 kB | | `content/webapp/.next/static/chunks/pages/search/images-956068e04d0220f0.js` | 2.3 kB | | `content/webapp/.next/static/chunks/pages/search/stories-e6399776d3b343ae.js` | 3.22 kB | | `content/webapp/.next/static/chunks/pages/search/works-709d146b869c6197.js` | 4.4 kB | | `content/webapp/.next/static/chunks/pages/seasons/[seasonId]-c94737f2473f0b08.js` | 2.29 kB | | `content/webapp/.next/static/chunks/pages/series/[seriesId]-c2bcf38d71b869f5.js` | 4.61 kB | | `content/webapp/.next/static/chunks/pages/slice-simulator-40e9d178dc079ef4.js` | 8.47 kB | | `content/webapp/.next/static/chunks/pages/stories-9ab55bc933117e6d.js` | 3.64 kB | | `content/webapp/.next/static/chunks/pages/stories/[contentType]-9605e52f859c08f7.js` | 3.31 kB | | `content/webapp/.next/static/chunks/pages/visit-us-9cb87520b48ea5d7.js` | 3.35 kB | | `content/webapp/.next/static/chunks/pages/visual-stories/[visualStoryId]-e0a141cacc28d60c.js` | 240 B | | `content/webapp/.next/static/chunks/pages/whats-on-93ae6a8d55dad977.js` | 203 B | | `content/webapp/.next/static/chunks/pages/whats-on/[period]-69293969c14f3c75.js` | 273 B | | `content/webapp/.next/static/chunks/pages/works/[workId]-09de93178bbc8627.js` | 25.7 kB | | `content/webapp/.next/static/chunks/pages/works/[workId]/download-99048e5b193569a5.js` | 3.1 kB | | `content/webapp/.next/static/chunks/pages/works/[workId]/images-bcf149ccffc02d15.js` | 1.08 kB | | `content/webapp/.next/static/chunks/pages/works/[workId]/items-bbe5411ff9aac00f.js` | 2.09 kB | | `content/webapp/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js` | 31 kB | | `content/webapp/.next/static/chunks/webpack-21f50ef569037b4f.js` | 2.25 kB | | `identity/webapp/.next/static/chunks/374.94537fd117195c86.js` | 2.48 kB | | `identity/webapp/.next/static/chunks/432.fa29da5acdb8e0b1.js` | 744 B | | `identity/webapp/.next/static/chunks/442-29780463d96993ea.js` | 8.35 kB | | `identity/webapp/.next/static/chunks/644-a3420a6bbc15048b.js` | 15.1 kB | | `identity/webapp/.next/static/chunks/677.a0884a27fb537187.js` | 19.9 kB | | `identity/webapp/.next/static/chunks/framework-19f3649580393c10.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-36dbb378188484a0.js` | 3.22 kB | | `identity/webapp/.next/static/chunks/pages/error-8117ccec5d62785a.js` | 1.7 kB | | `identity/webapp/.next/static/chunks/pages/index-1eae79998a41a8aa.js` | 11.9 kB | | `identity/webapp/.next/static/chunks/pages/registration-d07114234ef485c5.js` | 4.11 kB | | `identity/webapp/.next/static/chunks/pages/success-babc5c74ab7f7620.js` | 3.28 kB | | `identity/webapp/.next/static/chunks/pages/validated-2ef62657092669ba.js` | 3.36 kB | | `identity/webapp/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js` | 31 kB | | `identity/webapp/.next/static/chunks/webpack-713796e2734212eb.js` | 1.81 kB |

compressed-size-action

gestchild commented 1 month ago

Just to write down what I said when we discussed this at our catchup. The only other way I can think to do this is to create a slice which allows an editor to choose from a controlled list of things that could be added to the page, e.g. necessary_cookie_table, analytics_cookie_table etc. , rather than using the text slice and relying on the text being entered correctly. It would also mean that we wouldn't need to take these off the untransformedBody slice and render them separately. They would just be rendered by the SliceZone, like any other slice.

That might be overkill though.

rcantin-w commented 1 month ago

I love the idea and had considered creating a "dynamic content" or "coded content" slice for situations like this one and the postOutroContent trick, which is actually specific to only one (covid) page.

I think since it's only happened twice in over 4 years, though, I'm on the side of bringing that idea back to life if we come across another use-case, what do you think @gestchild ?

(add-on: Although I still think the searchResult slice could be hard-coded as well.. used only once and not super editor-friendly)

Screenshot 2024-05-29 at 12 21 35
gestchild commented 1 month ago

Happy to go with this until another use case arises. It wouldn't be difficult to switch over if that happens