untra / polyglot

:abc: Multilingual and i18n support tool for Jekyll Blogs
https://polyglot.untra.io
MIT License
394 stars 58 forks source link

Pages doubling #195

Closed igorfree closed 2 months ago

igorfree commented 2 months ago

I have following data structure before build (to separate my multilanguage pages):

+ root
    + de
        index.md
        ...
        links.md
    + en
        index.md
        ...
        links.md
    + uk
        index.md
        ...
        links.md

My default_language for the site is "de". After the build, inside _site directory, the data structure should look like this (pages in default language are created without subdirectory, pages for non-default languages are inside their own subdirectories):

+ _site
    index.html
    ...
    links.html
    + en
        index.html
        ...
        links.html
    ...

_site/index.html and _site/links.html are in German, _site/en/index.html and _site/en/links.html are in English.

However, in addition to the desired behaivour, additional subdirectories are created, like this:

+ _site
    index.html
    ...
    links.html
    + en
        index.html
        ...
        links.html
        + en
            links.html
            ...

_site/index.html and _site/links.html are in German, _site/en/index.html and _site/en/links.html are in English. _site/en/en/links.html is a duplicate and again in English. There are more pages than index and links, but the duplicating happens for all of them (except index).

Why are those duplicates created and how to get rid of them?

Front-matter for index.md (german):

---
title: "Willkommen auf meiner Webseite!"
lang: de
permalink: /
page_id: index
description: "Start"
---

Front-matter for links.md (german):

---
title: Links
permalink: /links.html
category: links
page_id: links
lang: de
bigNav: true
order: 4
description: "Interessante Links"
---

Front-matter for index.md (english):

---
title: "Welcome to my homepage!"
lang: en
permalink: /
page_id: index
description: "Home"
---

Front-matter for links.md (english):

---
title: Links
permalink: /links.html
category: links
page_id: links
lang: en
bigNav: true
order: 4
description: "Interesting links"
---
untra commented 2 months ago

Hi @igorfree 👋

Thanks for the feedback! Unfortunately I cannot debug your sites build issues with polyglot just by looking at the few template files. If you can share the code repo with me so I can clone it down and attempt to build and reproduce the issue, I can help ya that way. Otherwise here are some suggestions:

If you are using polyglot, chances are you might be using some other ruby gems. A few jekyll gems have been found to generate additional pages poorly when interacting with polyglot. Try identifying anything that might also be generating extra pages or content on jekyll page, if that can be interfering with correct site generation.

Clear out your existing _site directory and rebuild. Stale files in a build directory not cleaned up after newer builds are a source of misleading bugs. That's probably not what's happening here but I've seen duplicated site output happen that way.

For easier debugging, try setting parallel_localization: false in the config and reducing the number of built languages. set pages published: false in the frontmatter to prevent certain language pages from being included. Do this to narrow the issue down.

I hope this helps. Cheers and Good luck!

igorfree commented 2 months ago

thank you for the detailed answer @untra! It turned out, a simple rm _site/* -R was enough, no duplicates anymore. I thought jekyll would remove everything anyway each time it builds, but this has it's limits apparently.