untra / polyglot

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

jekyll build produces a different result than jekyll server for a language switcher #206

Open thebravoman opened 1 month ago

thebravoman commented 1 month ago

This is the language switcher

       {% for tongue in site.languages %}
          <a {% if tongue == site.active_lang %}style="font-weight: bold;"{% endif %} {% static_href %}href="{% if tongue == site.default_lang %}{{page.url}}{% else %}{{site.baseurl}}/{{ tongue }}{{page.url}}{% endif %}"{% endstatic_href %} >{{ tongue }}
          </a>
          {%- if forloop.last == false -%}
            {{"/"}}{{ site.langsep }}
          {%- endif -%}
        {% endfor %}

This is the config

title: My
email: my@example.com
description: >- # this means to ignore newlines until "baseurl:"
  Write an awesome description for your new site here. You can edit this
  line in _config.yml. It will appear in your document head meta (for
  Google search results) and in your feed.xml site description.
baseurl: "" # the subpath of your site, e.g. /blog
url: "" # the base hostname & protocol for your site, e.g. http://example.com

# Build settings
plugins:
  - jekyll-feed
  - jekyll-polyglot

languages: ["en", "bg"]
default_lang: "en"
exclude_from_localization: ["assets"]
parallel_localization: true

Running jekyll serve produces _site/bg/index.html

    <a  href="/" >en
          </a>/
          <a style="font-weight: bold;" href="/bg/" >bg
          </a>

Running jekyll build produces _site/bg/index.html

    <a  href="/bg/" >en
          </a>/
          <a style="font-weight: bold;" href="/bg/" >bg
          </a>

Is this the expected behaviour or am I missing something? You see how the href in the first case is / and in the second it is bg