contentlayerdev / contentlayerdev/contentlayer

allow to configure how `reference` field values resolves to file paths

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

Beschreibung

currently, [`reference` fields](https://www.contentlayer.dev/docs/reference/source-files/field-types#reference) expect a path to another document file, relative to `contentDirPath`. it would be great if we could configure how a reference field value resolves to the relative file path.

in my case, i am using "Netlify CMS", which also has a similar concept of [`relation` fields](https://www.netlifycms.org/docs/widgets/#relation) (and saves to markdown/yaml). however, it will only save the `slug` as field value, and use the `folder` and `extension` of a `collection` to construct file paths. e.g. it will save `"my-tag"` as relation field value, to reference a document in `"tags/my-tag.yml"` (when the `tags` collection has `folder: "tags", extension: "yml"` configured)

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne damit nachzuverfolgen, wie Referenzfelder Pfade relativ zu contentDirPath auflösen. Definiere den erforderlichen Konfigurationseinstiegspunkt, um einen gespeicherten Slug dem Dokumentpfad zuzuordnen, einschließlich des Collection-Ordners und des Verhaltens der Erweiterung. Als erledigt gilt, wenn Referenzwerte wie "my-tag" in Pfade wie "tags/my-tag.yml" aufgelöst werden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
backend
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

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