kurtsson / jekyll-multiple-languages-plugin

I18n support for Jekyll and Octopress
MIT License
923 stars 201 forks source link

Plugin Completely Broken--site.baseurl_root and variables unusable #119

Closed 88kbbq closed 5 years ago

88kbbq commented 6 years ago

Is this project still maintained? Where can we get support? {{ site.baseurl_root }}/{{ site.lang }} sees blank spaces or underlines in rendered HTML.

acmoles commented 6 years ago

+1

I've noticed base_url works as expected in a build but not with jekyll serve

88kbbq commented 6 years ago

I've elected to simply use data files and font matter for multilingual functionality. It works and it's easier to template and maintain. https://github.com/88kbbq/jekyll-template

acmoles commented 6 years ago

I've managed to get things working well, it's just a shame Github Pages doesn't support this plugin.

joshcummingsdesign commented 5 years ago

Hi @88kbbq 👋 Are you still experiencing this issue with v1.6.0? If so let me know and I'll look into it.

88kbbq commented 5 years ago

@joshcummingsdesign I ended up just using data files and markdown to achieve multilingual functionality. I have three languages, check here.

Pretty much got everything done, including multilingual sitemap, schema markup, and alternate URLs. Works well, but it's not a change-one-change-all solution. I still have to manually update navigation, but other than that it's good. I could fix that but the site is small, no need. I think it's pretty good, need the template, let me know.

joshcummingsdesign commented 5 years ago

@88kbbq Cool! Thanks for letting me know. Going to close this issue out. Let us know if there is something further you need.

@kurtsson Can be closed.

george-gca commented 1 year ago

I've been experiencing this issue. More specifically, site.baseurl and site.baseurl_root are unusable. What I believe would be a simple

{{ post.url | prepend: site.baseurl }}

I have to do an if/else like this one

{% if site.lang == 'en' %}{{ post.url | relative_url }}{% else %}/{{site.lang}}{{ post.url | relative_url }}{% endif %}

since | relative_url don't add the language information. Running the latest version of the al-folio theme, with Ruby 3.1.2 and the following dependencies:

Gems included by the bundle:
  * activesupport (7.0.4)
  * addressable (2.8.1)
  * bibtex-ruby (6.0.0)
  * bundler (2.3.7)
  * citeproc (1.0.10)
  * citeproc-ruby (1.1.14)
  * colorator (1.1.0)
  * concurrent-ruby (1.1.10)
  * crass (1.0.6)
  * csl (1.6.0)
  * csl-styles (1.0.1.11)
  * cssminify2 (2.0.1)
  * em-websocket (0.5.3)
  * eventmachine (1.2.7)
  * execjs (2.8.1)
  * feedjira (3.2.1)
  * ffi (1.15.5)
  * forwardable-extended (2.6.0)
  * gemoji (3.0.1)
  * html-pipeline (2.14.2)
  * htmlcompressor (0.4.0)
  * http_parser.rb (0.8.0)
  * httparty (0.20.0)
  * i18n (1.12.0)
  * jekyll (4.2.2)
  * jekyll-archives (2.2.1)
  * jekyll-diagrams (0.10.0)
  * jekyll-email-protect (1.1.0)
  * jekyll-feed (0.16.0)
  * jekyll-imagemagick (1.4.0)
  * jekyll-minifier (0.1.10)
  * jekyll-multiple-languages-plugin (1.8.0)
  * jekyll-paginate-v2 (3.0.0)
  * jekyll-sass-converter (2.2.0)
  * jekyll-scholar (7.1.0)
  * jekyll-sitemap (1.4.0)
  * jekyll-target-blank (2.0.0)
  * jekyll-twitter-plugin (2.1.0)
  * jekyll-watch (2.2.1)
  * jemoji (0.12.0)
  * json (2.6.2)
  * json-minify (0.0.3)
  * kramdown (2.4.0)
  * kramdown-parser-gfm (1.1.0)
  * latex-decode (0.4.0)
  * libv8-node (16.10.0.0)
  * liquid (4.0.3)
  * listen (3.7.1)
  * loofah (2.19.0)
  * mercenary (0.4.0)
  * mime-types (3.4.1)
  * mime-types-data (3.2022.0105)
  * mini_racer (0.6.3)
  * minitest (5.16.3)
  * multi_xml (0.6.0)
  * namae (1.1.1)
  * nokogiri (1.13.8)
  * pathutil (0.16.2)
  * public_suffix (5.0.0)
  * racc (1.6.0)
  * rb-fsevent (0.11.2)
  * rb-inotify (0.10.1)
  * rexml (3.2.5)
  * rouge (3.30.0)
  * safe_yaml (1.0.5)
  * sassc (2.4.0)
  * sax-machine (1.3.2)
  * terminal-table (2.0.0)
  * tzinfo (2.0.5)
  * uglifier (4.2.0)
  * unicode-display_width (1.8.0)
  * unicode_utils (1.4.0)
  * webrick (1.7.0)
george-gca commented 1 year ago

I just found out that these variables happen to be empty if I set my baseurl to / instead of something else. I created the language toggle button like this in the _includes/header.html:

<!-- Toogle language -->
<li class="nav-item active">
{% if site.lang == "en" %}
    <a class="nav-link" href="{{site.baseurl_root}}/pt-br{{page.url}}"> PT-BR </a>
{% elsif site.lang == "pt-br" %}
    <a class="nav-link" href="{{site.baseurl_root}}{{ page.url }}"> EN </a>
{% endif %}
</li>

then, set my baseurl like this in the `_config.yaml'

baseurl: /al-folio

This seems to work, as the link that appears when I click on the PT-BR button is http://127.0.0.1:4000/al-folio/pt-br/. But when I changed my baseurl to

baseurl: /

the link that appears on the toggle is just http://pt-br/.