Nested fragments for centralized and milo block supporting 404 page #795
Replies: 3 comments 3 replies
-
I think the best solution would be to add block loading support in 404.js. When it's loaded we can continue to hide the page. In addition to that, we could also add a metadata property that specifies where the 404 file to use is located, something like |
Beta Was this translation helpful? Give feedback.
-
How about creating your own template?
Then you implement your own my404.js and my404.css. |
Beta Was this translation helpful? Give feedback.
-
Here you go. https://github.com/adobecom/milo/compare/central-404?expand=1 Milo CC
|
Beta Was this translation helpful? Give feedback.
-
Nested fragments for centralized and milo block supporting 404 page
Requirement -
We are working on the story to create a solution for centralized 404 which can render the new 404 adobe.com page - https://main--milo--adobecom.hlx.page/drafts/mathuria/fragments/404-milo-main
JIRA - https://jira.corp.adobe.com/browse/MWPW-130971
Problem statement -
Currently on Milo we can only render one format of 404 https://milo.adobe.com/404-url
The 404.html in every project has tag set which loads milo 404 template.
The document file is authored without blocks https://milo.adobe.com/404.
Once the page load completes it checks for meta tag, milo loads 404 plain html file (if the template meta tag is set) from content root and loads 404.js and 404.css
The JS and CSS convert https://milo.adobe.com/404 to https://milo.adobe.com/404-url
Since the template load happens after loadLCP we cannot add milo blocks or re-author the 404 file in a different way.
Adobe.com required a solution to -
Proposed solution -
We have explored a solution to make the above two requirements possible using nested fragments and wanted some inputs on the same.
The change would need us to
a. Remove the meta tag so that the template 404 js and css does not load.
b. Add a a href tag in main div containing a fragment link and add a class to main tag so that we can write a css to make this fragment occupy 100% screen width
<main class='divFor404'> <div> <a href='https://main--milo--adobecom.hlx.page/drafts/mathuria/fragments/404-milo-main'></a> </div> </main>
c. Author the fragment on 404 html 404-milo-main.docx and add another fragment 404-milo-body.docx inside this document
When user hits 404 page milo loads the 404 template from en folder https://main--milo--adobecom.hlx.page/drafts/mathuria/fragments/404-milo-main.plain.html. The fragment is rendered that contains another fragment.
Milo loads the nested fragment from corresponding locale root. We can keep the second fragment inside milo/fragment and milo/locale/fragment.
We keep only one main central fragment 404-milo-main and have the centralized 404 body in specific locale folders inside milo project.
Since we have already removed the template and the 404.js does not load it does not clear the already painted 404.
Sharing git diff of required changes https://github.com/adobecom/cc/compare/main...aishwaryamathuria:cc:test404?expand=1
Please share your thoughts and inputs on the above approach?
Adding -
@chrischrischris @auniverseaway @salonijain3 @amitbikram @rgclayton @vhargrave @narcis-radu @dstrong23 @Ruchika4 @seanchoi-dev
Beta Was this translation helpful? Give feedback.
All reactions