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

fetch newsletter layouts #27587

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

Conversation

dblatcher
Copy link
Contributor

@dblatcher dblatcher commented Nov 8, 2024

What is the value of this and can you measure success?

The /emai-newsletters page currently uses hard-coded data in the DCR repo describing how the newsletters should be arranged for each Edition (UK, US, Aus, International).

Any change to the layouts require a PR into DCR, but the data could instead be managed from the existing newsletters tool and published on the newsletters api, allowing editorial to self-serve for changes - see guardian/newsletters-nx#328

This PR has fronted provide the data on the page model to DCR so that DCR can use it instead of the hard coded version.

What does this change?

  • Adds a method to fetch newsletter layout data (Map of Edition id to newsletter layout )from the newsletters-api, and cache it using the existing NewsletterSignupAgent
  • Adds the an optional "layout" object to the DotcomNewslettersPageRenderingDataModel
  • When building the DotcomNewslettersPageRenderingDataModel for a request for the /email-newsletters page, the layout for the Edition of the request is included in the model.

Test

Run DCR (this branch - guardian/dotcom-rendering#12795 ) and frontend locally and open http://localhost:3000/email-newsletters

The layout data used will be from https://newsletters.code.dev-guardianapis.com/api/layouts - (if there is no layout defined for the Edition you are viewing, DCR will fallback to its default layout including all live newsletters)

Checklist

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