Multilingual website with Metalsmith

I tried different combinations of plugins for Melatsmith, but I still need help. Could you suggest how to transform the structure as follows:

src/
  pages/
    about/
      index_de.md
      index_en.md
    contact/
      index_de.md
      index_en.md
  posts/
    my-first-post/
      index_de.md
      index_en.md
    my-second-post/
      index_de.md
    my-third-post/
      index_en.md

AT:

build/
  de/
    pages/
      about/
        index.html
      contact/
        index.html
    posts/
      my-first-post/
        index.html
      my-second-post/
        index.html
  pages/                # english by default
    about/
      index.html
    contact/
      index.html
  posts/               # english by default
    my-first-post/
      index.html
    my-third-post/
      index.html

Unfortunately, all articles on plural language in Metalsmith already have a locale folder in it src. In my version I do not want to have it, but instead I provide different versions of the files .mdfor each locale.

+4
source share
1 answer

In fact, I have the same taks.

I try to use this package , but I get the result only for files that are not in directories.

as

src/
   dir/
     index2_uk.md
     index2_en.md
   index_uk.md
   index_en.md

converted to

 dist/
    dir/
      index2_uk.html
      index2_en.html
    en/
      index.html
    index.html

instead

 dist/
    en/
       index.html
       index2.html
    index.html
    index2.html

I understand why, but it does not work with files in directories.

If you have a solution, let me know.

0
source

Source: https://habr.com/ru/post/1649759/


All Articles