kurtsson / jekyll-multiple-languages-plugin

I18n support for Jekyll and Octopress
MIT License
922 stars 203 forks source link

When you click in another language, you are called to sign in #161

Closed gusbemacbe closed 4 years ago

gusbemacbe commented 4 years ago

Hello,

I use GitLab.

Repository: https://gitlab.com/gusbemacbe/dicas-para-alunos-da-dankicode Site: https://gusbemacbe.gitlab.io/dicas-para-alunos-da-dankicode/

When you click in the Portugal flag, then click in the Brazilian site you are called to sign in. I do not know why. But you can check the repository or these code sources here.

Small code in the file index.md:

{% if site.lang == "pt_PT" %}
  **Idiomas:** <a href="index.html" alt="Português brasileiro" name="Português brasileiro" title="Português brasileiro">{% t global.pt_br %}</a>
{% elsif site.lang == "pt_BR" %}
  **Idiomas:** <a href="pt_PT/index.html" alt="Português europeu" name="Português europeu" title="Português europeu">{% t global.pt_pt %}</a>
{% endif %}

And it also causes to call you to sign in:

{% if site.lang == "pt_PT" %}
  {% capture link1 %}{{ site.baseurl_root }}{{ page.url}}{% endcapture %}
**Idiomas:** <a href="{{ link1 }}" alt="Português brasileiro" name="Português brasileiro" title="Português brasileiro">{% t global.pt_br %}</a>
{% elsif site.lang == "pt_BR" %}
  {% capture link2 %}{{ site.baseurl_root }}/pt_PT{{ page.url  }}{% endcapture %}
**Idiomas:** <a href="{{ link2 }}" alt="Português europeu" name="Português europeu" title="Português europeu">{% t global.pt_pt %}</a>
{% endif %}

Observe that I used tl in another page captura-de-tela.md, but it causes you to be called to sign:

---
namespace: captura
permalink: /captura-de-tela.html
permalink_pt_BR: /captura-de-tela.html
permalink_pt_PT: /captura-de-ecrã.html
---

{% if site.lang == "pt_PT" %}
  **Idiomas:** <a href="{% tl captura pt_BR %}" alt="Português brasileiro" name="Português brasileiro" title="Português brasileiro">{% t global.pt_br %}</a>
{% elsif site.lang == "pt_BR" %}
  **Idiomas:** <a href="{% tl captura pt_PT %}" alt="Português europeu" name="Português europeu" title="Português europeu">{% t global.pt_pt %}</a>
{% endif %}

In the .gitlab-ci.yml:

image: ruby:2.7

variables:
  JEKYLL_ENV: production
  LC_ALL: C.UTF-8

before_script:
  - gem install bundler
  - bundle install

pages:
  stage: deploy
  script:
  - bundle exec jekyll build -d public
  artifacts:
    paths:
    - public
  only:
  - master

And _config.yml:

defaultLang: pt_BR
languages: ["pt_BR", "pt_PT"]
languageNames:
  pt_BR: Português brasileiro
  pt_PT: Português europeu

plugins:
  - html-proofer
  - jekyll-assets
  - jekyll-coffeescript
  - jekyll-feed
  - jekyll-multiple-languages-plugin
  - jekyll-relative-links
  - jekyll-seo-tag
  - jekyll-sitemap
  - rouge
  - sassc
relative_links:
  enabled: true
  collections: true
include:
  - contributing.md
  - readme.md
  - license.md
  - copying.md
  - code_of_conduct.md
  - contributing.md
  - issue_template.md
  - pull_request_template.md

kramdown:
    input:              GFM
    auto_ids:           true
    hard_wrap:          false
    toc_levels:         1..6
    toc_panel:          true
    syntax_highlighter: rouge

    syntax_highlighter_opts:
        css_class: 'highlight'
        # line_numbers: true # má ideia, spans não precisam lineos e herdariam esta opção
        # default_lang: text # experimente esta última
        span:
            line_numbers: false
            disable: true
        block:
            line_numbers: false
            start_line: 1
        # inline_theme: monokai.sublime # na verdade funciona bem, além de ficheiros diferentes sem fundo

markdown: kramdown
sass:
  line_comments: false
  sourcemap: never
  style: expanded

exclude: 
  - "scripts"
  - "templates"

include: 
  - ".htacess"
permalink: /:year/:month/:day/:title/

assets:
  source_maps: false
  destination: "/assets"
  compression: false
  gzip: false
  defaults:
    integrity:
      {css, imagens, js}: false
  caching:
    enabled: false
    path: ".jekyll-cache/assets"
    type: file
  cdn:
    baseurl: false
    destination: false
    url: null
  sources:
    - assets/css
    - assets/imagens
    - assets/js
  source_maps: false