11ty / eleventy

A simpler site generator. Transforms a directory of templates (of varying types) into HTML.
https://www.11ty.dev/
MIT License
17.18k stars 494 forks source link

MultiDomain site support (multi linguale) #1168

Closed Dexus closed 5 months ago

Dexus commented 4 years ago

Is your feature request related to a problem? Please describe. If I create a website that is multilingual, I would like to be able to specify a domain for the permalink or for the collection item.url for each language with basedomain.

currently the permalink is unique and so it is not possible to use the subdomain style for multilinguale websites or multi-websites that all based on the same project.

Describe the solution you'd like permalink: "https://{{ locale }}.{{baseUrl}}/blog/{{ page.fileSlug }}/index.html" or permalink: "https://{{baseUrl}}/blog/{{ page.fileSlug }}/index.html" without error about already existing permalinks - if the baseurl is different.

Describe alternatives you've considered The possibility to create a JSON in the content directory, which marks this directory as a separate domain, so that it contains a separate directory with all assets when generating. As well as the possibility to link directly to this website or to retrieve data via Collections.

Additional context

+----Content
++-----_data
++-----_includes
++-----de
+++-------de.json(https://de.example.com/)
+++-------index.njk (permalink: /index.html)
++-----en-us
+++-------en-us.json(https://en-us.example.com/)
+++-------index.njk (permalink: /index.html)
zachleat commented 4 years ago

Any issues with running Eleventy twice, sequentially? One for each language?

klauss194 commented 2 years ago

@zachleat - How would you avoid duplicating pages for each langauge-folder ? I would love to Not duplicate website pages in each language folder ( pages like about us , homepage ) -> or automatically copy these parent templates just replacing the language variable in them and keeping translations in the jsons.

++-----_data ++-----_includes ++-----pages <- input folder ++-------homepage.njk ++-------about-us.njk ++-------our-vision.njk ++-----de +++-------de.json(https://de.example.com/) +++-------index.njk (permalink: /index.html) ++-----en-us +++-------en-us.json(https://en-us.example.com/) +++-------index.njk (permalink: /index.html)

zachleat commented 5 months ago

11ty now includes i18n documentation and an i18n plugin:

https://www.11ty.dev/docs/i18n/ https://www.11ty.dev/docs/plugins/i18n/

Thanks y’all!