contentlayerdev / contentlayerdev/contentlayer

Support for localization (e.g. for Contentful)

Đang mở
#14 12 bình luận 1 reaction 0 người được giao Xem trên GitHub
feature pkg/source-contentful
Ngôn ngữ chính
TypeScript
Star
3.5k
Fork
192
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.