Replies: 2 comments 1 reply
-
I put together a "proof of concept" branch over the last 10% day, which might illustrate what I have in mind a bit better: https://github.com/guardian/dotcom-rendering/tree/dblatcher/stand-alone-pages |
Beta Was this translation helpful? Give feedback.
1 reply
-
This definitely has raised some interesting questions around adding new routes to DCR. We'll close this discussion, but should probably open up a discussion on how we do this in a simpler way in future. Most of the implementation can be seen in this PR and it's corresponding frontend PR. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Could we migrate the all newsletters page from Frontend to DCR?
The "all newsletters" page is currently rendered by Frontend as a static page. The newsletters team have a new design to implement next quarter and rendering through Frontend in the same way is unlikely to be maintainable. Our preference would be to render the new version of the page through DCR so we can:
DCR doesn't currently have a pattern for rendering "stand alone" pages (IE pages which are neither articles or fronts) so we are looking to get some input if doing this is feasible and how to approach it.
Optimistic, over-simplified plan
Currently, DCR express App renders Article pages and Fronts pages (in development) using
renderFront
andrenderArticle
functions (which usearticleToHtml
andfrontToHtml
). Both recieve data from frontend, of the typesFEArticleType
andFEFrontType
, which act as page models.To follow this pattern, and re-use much of the utility code used for Articles and Fronts, we could:
NewslettersPageModel
type, withconfig
,nav
,footer
etc data included in theFEArticleType
typesrenderNewslettersPage
function, that would use anewslettersToHtml
functionNewslettersPageModel
as a propNewslettersPageModel
as a json payload and post it to the new route and render the returned HTML instead of constructing the page with Scala.Suggested page model type definition
Current Newsletters page flow
link
Proposed Newsletters page flow
link
Refactor opportunities / offshoot idea
If we keep the data and functionality that is specific to the newsletters page separate from the general page information, it could acts a template for similar 'stand alone' pages. A generic render to HTML function might have a structure like this:
From this discussion there was a ticket to migrate the existing https://www.theguardian.com/help/accessibility-help page to DCR. If this is still required, it could potentially build off the Newsletters page work.
The
populatePageTemplate
function would replicate many of the steps withinarticleToHtml
(see the steps in the dark box in the diagrams below). Potentially,articleToHtml
andfrontToHtml
could be refactored to use this 'page type agnostic' function and reduce duplication.DCR article page flow (simplified)
DCR article fronts page flow (simplified, in development)
Beta Was this translation helpful? Give feedback.
All reactions