Closed yonz2 closed 10 months ago
I added some debug code to try to find out what's happening. The page.url variable is always set to the url of the first post and the page.permalink variable is always empty.
<br/><span>Page-url: {{ page.url }} # Page-Permalink: {{ page.permalink }} # </span>
results in:
<span>Page-url: /ai/2023/11/15/ai-itsm-en.html # Page-Permalink: # </span>
Hey there @yonz2 👋
does the /ai/2023/11/15/ai-itsm-en.md
post have a defined url or permalink?
Jekyll uses a default url format based on the post's date and title:
/:year/:month/:day/:title.html
/2023/12/21/my-post-title.html
when a permalink is not defined, the url gets inferred like that. that looks like what's happening here.
I cannot help you debug markdown specific problems further without access to your repo though. care to share?
Happy New Year!
The repo https://github.com/yonz2/netinnovate is public.
This seems to be a general issue with all page
variables.
Here is another debug code: (See: lang-switcher.html
)
<select id="language-switcher-select" autocompletion="off" onchange="window.location.href = this.value;">
{% for lang in site.languages %}
<option value="{{ lang }}" {% if lang==page.lang %}selected{% endif %}>{{ site.data[lang].l10n.lang_name }}</option>
<!-- {{ lang }} , {{ page.lang }}, {{ site.default_lang }}, {{ page.title }} -->
{% endfor %}
</select>
Results:
<select id="language-switcher-select" autocompletion="off" onchange="window.location.href = this.value;">
<option value="en" selected>English</option>
<!-- en , en, en, Revolutionizing ITSM with AI: Automating Issue Classification and Resolution -->
<option value="de" >Deutsch</option>
<!-- de , en, en, Revolutionizing ITSM with AI: Automating Issue Classification and Resolution -->
</select>
The page.title
output, is the title from the first blog post, NOT from the current page being processed
(BTW: I changed the way I'm dealing with the language switcher, but the problem with the page
variables remains
Any help will be much appreciated Yonz
The
page.title
output, is the title from the first blog post, NOT from the current page being processed
So... you're saying you always see Revolutionizing ITSM with AI: Automating Issue Classification and Resolution
displayed for the title of every page? jekyll page variables like page.title
are fairly high level, this shouldn't be affected by polyglot at all.
Otherwise the lang-switcher.html
behavior and <!--
outputs look right if rendered for this page. I do notice however it specifies in the frontmatter layout: single
and I don't see that single.html
layout specified in the repo includes? That smells to me.
Hi,
the file single.html
is a layout from the Minimal Mistakes theme usually located at: /usr/local/rvm/gems/ruby-3.2.2/gems/minimal-mistakes-jekyll-4.24.0/_layouts/single.html. I've now copied the default.html and single.html files to the repo.
The output is from _site/de/about/index.html
the corresponding markdown file about-de.md
has the following frontmatter:
---
layout: single
title: Über uns
permalink: /about/
page-id: about
header:
overlay_image: /assets/images/NetInnovate_TitleImage.png
lang: de
toc: false
---
So you can see that both page.lang
and page.title
are output incorrectly (I've added the ./_site
folder to the repo)
Hi, I opened an issue on the jekyll repo as well (https://github.com/jekyll/jekyll/issues/9519)
I'm not sure I can help ya here, sorry.
Hi all,
I'm trying to put up a multi-lingual website (initially, bilingual: English and German). i installed
jekyll-polyglot
, created content pages in both languages, e.g. home-en.md, home-de.md, about-en.md and about-de.md all with front matter set like: (note: I am using the Minimal Mistakes themeI also created a couple of test posts, each with front matter similar to:
Then I copied a simple language switcher from github:
placed it in the
lang-switcher.html
inside the _include directory and included that file in themasthead.html
file in the same directory.This is where the "fun" starts:
When I render my site using
bundle exec jekyll build
thepage.url
variable returns a value pointing to one of the posts. For example this is what's rendered in the German about file at_site/de/about/index.html
:Expected Results:
So here's my question. What can i do to get the correct url in my language switcher?
My Environment: