contentlayerdev / contentlayerdev/contentlayer

Support for localization (e.g. for Contentful)

Offen
#14 12 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
feature pkg/source-contentful
Vorherrschende Sprache
TypeScript
Sterne
3.5k
Forks
192
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

While I guess that it is currently possible to localize MDX based on frontmatter tags, doing this would mean that the filenames would need to be different, resulting in different slugs which would certainly not be ideal. I guess there are other ways to achieve it, but none of them seem ideal, that's why it would be great to support l10n (and also just because Contentlayers goal is to be the abstraction layer between data and code).

I assume that there could be several ways for structuring the MDX files, but what comes to my mind first is either via file name eg. `/pages/about.mdx` `/pages/about.de.mdx` or via subfolders eg. `/pages/en/about.mdx` `/pages/de/about.mdx`.

Edit: the following structure seems pretty nice, but would depend on #11
```bash
├── data
│ ├── pages
│ │ ├── about
│ │ │ ├── index.mdx
│ │ │ ├── index.de.mdx
│ │ │ ├── picture.jpeg
│ │ ├── privacy
│ │ │ ├── index.mdx
│ │ │ ├── index.de.mdx
│ │ │ ├── cover.jpeg
```

For Contentful one just needs to add `&locale=` https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/localization

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Prüfe das vorgeschlagene Layout von /pages/about.mdx und den Locale-Unterordnern. Lies anschließend die Abhängigkeit von Issue #11 sowie die im Bericht verlinkte Contentful-Lokalisierungsreferenz. Lege fest, wie lokalisierte MDX- und Contentful-Daten unter Beibehaltung stabiler Slugs dargestellt werden sollen. Als erledigt gilt die Aufgabe, wenn die gewählte Struktur und das Verhalten dokumentiert und konsistent unterstützt werden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
content, localization
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.