voorhoede / head-start

Base setup on top of headless services to help you quickly start a new website
ISC License
3 stars 0 forks source link

feature: Nested pages #97

Closed jbmoelker closed 6 months ago

jbmoelker commented 7 months ago

Changes

Associated issue

Resolves #13 .

How to test

  1. Open preview link
  2. Navigate to a nested page like /en/overview-page/page-1/, /en/overview-page/demos/tables/, /nl/-/-/tabellen/.
  3. Verify pages load, their URLs are constructed using their slugs and those of their parent pages.
  4. Verify parent pages unavailable in a specific locale are replaced with a dash in the URL (like /nl/-/-/tabellen/).
  5. Verify locale switcher works on nested pages
  6. Verify breadcrumb navigation works (for example on /en/overview-page/demos/tables/ or /en/search/?query=heading).
  7. Verify URLs and navigation still work on pages that are not nested.

Checklist

cloudflare-pages[bot] commented 7 months ago

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: ed1e696
Status: ✅  Deploy successful!
Preview URL: https://06b7b467.head-start.pages.dev
Branch Preview URL: https://feat-nested-pages.head-start.pages.dev

View logs

jbmoelker commented 6 months ago

@decrek and @phortuin mentioned the use use of a placeholder for missing parent pages, when a parent page is unavailable in a given locale, currently filled with - (like /-/page-slug/) is odd. @decrek prefers builds to fail if translation of a parent page is missing for a given locale.

I agree having non-translated parent pages is undesirable. However this is a consequence of making all locales optional. For now, I would leave this up to content editors. If we have a better solution in the future, we can create a PR for that. For now, I'm merging this one so we have a working solution.

phortuin commented 6 months ago

\o/

prefers builds to fail if translation of a parent page is missing for a given locale this is a consequence of making all locales optional

Yeah, agree that build should not fail on optional content. Also, it's a realistic scenario that a website has pages in a certain locale only (product is only sold in certain countries; blog posts that are not translated... know any company that does that?) and the nesting of pages should have no relation to existing locales.

Use case below is improbable but not unthinkable: