Jekyll 4 Conflict errors
Jekyll - lingering conflict error
The only error I was still seeing after upgrading to Jekyll 4.0 is the following:It took me a bit of time to figure this one out, but the solution ended up being quite simple -1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
... Conflict: The following destination is shared by multiple files. The written file may end up with unexpected contents. /website/_site/tag/js/index.html - tag/js/index.html - tag/js/index.html Conflict: The following destination is shared by multiple files. The written file may end up with unexpected contents. /website/_site/tag/nodejs/index.html - tag/nodejs/index.html - tag/nodejs/index.html ...
I was using tags and mixing their lowercase and uppercase (e.g. NodeJS, nodejs, nodeJS).
Once I aligned the tags to be lowercase at all times, this solved all the conflict errors.Posted in TechnologyUpgrading Jekyll 2.x to 4.x
(or: I already mentioned it's a very old Jekyll setup)
Turns out I did make it to item #984 on my TODOs.
Upgrading Jekyll has proven to be far easier than migrating to Hugo.
There were only 2 issues to tackle:Issue 1 - Generating Categories and Tags in Jekyll 4.x.x
The old scripts of generate_categories.rb and generate_tags.rb and their corresponding liquid filters: tag_links and category_links no longer seem to do the trick in Jekyll 4.
Is it likely possible to fix these functions and keep using the liquid filters? Probably. Is it necessary? Nope.
It's much easier to just build a template that does the same job and is certainly more future-proof.
In short, this was the old template:
old_template.htmlnew_template.html1 2 3 4 5
{% raw %} <!-- This used to work for Jekyll 2 --> <div class="post-tags">Tagged with <span>{{ post.tags | tag_links }}</span></div> <div class="post-category">Posted in <span>{{ post.categories | category_links }}</span></div> {% endraw %}
Full example here (including the old scripts and new template).1 2 3 4 5 6 7 8 9 10 11 12 13
{% raw %} {% comment %}<!-- TODO put this in a separate include to save some trouble. Obviously there's some room for improvement here. -->{% endcomment %} <div class="post-tags">Tagged with <span> {% for tag in post.tags %} <a class="tag" href="{{ "/tag/" | append: tag | downcase | replace: " ", "-" | uri_escape }}">{{ tag }}</a>{% if forloop.last %}{% else %}, {% endif %} {% endfor %} </span></div> <div class="post-category">Posted in <span> {% for category in post.categories %} <a class="category" href="{{ "/category/" | append: category | downcase | replace: " ", "-" | uri_escape }}">{{ category }}</a>{% if forloop.last %}{% else %}, {% endif %} {% endfor %} </span></div> {% endraw %}
Issue 2 - Unrendered liquid in Paginator
On generated pages (page/##) I was getting unrendered Jekyll liquid code for my meta_description.
Why? Not sure. A relatively simple IF change helped handle this and grab the correct parts -This ended up giving me the same meta_descriptions as I used to get on Jekyll 2.x.1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
{% comment %} TODO this should likely be resolved by proper layout usage (dedicated paginator page layout for starters) {% endcomment %} {% assign meta_desc = site.description %} {% raw %}{% unless page.url == '/' %} {% if page.meta_description %} {% capture meta_desc %}{{ page.meta_description }}{% endcapture %} {% elsif page.excerpt %} {% capture meta_desc %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% endcapture %} {% elsif page.content %} {% if page.content contains "for post in paginator.posts" %} {% capture meta_desc %}{{ paginator.posts | first | strip_html | strip_newlines | strip | split: " - " | first | truncate: 160 }}{% endcapture %} {% else %} {% capture meta_desc %}{{ page.content | strip_html | strip_newlines | strip | truncate: 160 }}{% endcapture %} {% endif %} {% endif %} {% endunless %} {% endcapture %} <meta name="description" content="{{ meta_desc }}"> {% endraw %}
The good news is that the build time has decreased by 10X!
The really good news is that it's now fully within GitHub Actions!Posted in TechnologyAdventures of a very old Jekyll Setup
A waterfall of errors
So I've been writing on an old Jekyll website of mine.
Sooner or later I promised myself to move it to Hugo, however it's #983 on the TODO list.
For now, during the build I have been bombarded with the following 5 errors on repeat:Obviously the real answer here would be to upgrade my Jekyll setup to ensure Ruby stops complaining about my ancient stack.1 2 3 4 5
/var/lib/gems/2.7.0/gems/jekyll-3.1.2/lib/jekyll/convertible.rb:42: warning: Using the last argument as keyword parameters is deprecated /var/lib/gems/2.7.0/gems/jekyll-3.1.2/lib/jekyll/document.rb:265: warning: Using the last argument as keyword parameters is deprecated /var/lib/gems/2.7.0/gems/jekyll-3.1.2/lib/jekyll/tags/include.rb:169: warning: Using the last argument as keyword parameters is deprecated /var/lib/gems/2.7.0/gems/jekyll-3.1.2/lib/jekyll/url.rb:119: warning: URI.escape is obsolete /var/lib/gems/2.7.0/gems/rb-inotify-0.9.7/lib/rb-inotify/watcher.rb:66: warning: rb_safe_level will be removed in Ruby 3.0
I have promptly placed upgrading my stack as item #984 on the TODO list (as this is running in isolation, it's not a huge threat).
For the time being, I am using the following command to silence the noise:1
bundle exec jekyll serve 2>&1 | egrep -v 'deprecated|obsolete|rb_safe_level'
Posted in TechnologyTips for Jekyll development
Continuing the WordPress to Jekyll series,
I've decided to give a few Jekyll tips that I've learned in the process of converting my website.Jekyll serve at the speed of light
Over 5 years, I've written quite a few posts, over 500 posts.
To test Jekyll out (for development) you have to run the following command:However, with 500+ posts, it takes about 70-90 seconds to build, which is annoying if you're making small tweaks,1
jekyll serve
that take minutes to compile.
There's a cool little trick to make compilation happen a lot quicker, by limiting the number of posts:This will only compile the last 3 posts, which is enough for 99% of test cases anyways.1
jekyll serve --limit_posts=3
The average compilation time with the limit_posts parameter is about 3-4 seconds.
This is a great trick especially if you have a bigger blog with 1000+ posts.Posted in TechnologyMoving from WordPress to Jekyll
Since last week you may have noticed something different about the website.
Maybe it seems to load quicker, or it looks a tiny bit different, or perhaps you've noticed that the footer is much slimmer.
The reason is: KidsIL has once again been transformed!Posted in Technology- Previous Page: 1 of 1 Next