Skip to content

major/minor/patch not assigned correctly #258

Description

@chizmeeple

I'm attempting to debug an issue with the/my page based on the welcome layout.

I noticed a lot of code checking major and minor but when debugging I found those values were blank.

I discovered where this is set (_layout/base.html) and I believe there are two issues here:

  1. the result of split is assigned to version, but the next steps rely on v[x]
  2. the values when correctly parsed are strings, not ints.

I believe you need to replace:

{% assign version = jekyll.version | split:'.' %}
{% assign major = v[0] %}
{% assign minor = v[1] %}
{% assign patch = v[2] %}

with

{% assign splitv = jekyll.version | split:'.' %}
{% assign major = splitv[0] |plus: 0 %}
{% assign minor = splitv[1] |plus: 0 %}
{% assign patch = splitv[2] |plus: 0 %}

Looking into things a little further, I don't think the scope of assign propagates outside base.html so

base -> about -> welcome

which is trying to make use of major/minor/patch is essentially working with null values and alwys falling through to the else condition.

Ref: jekyll/jekyll#4370

I believe the version splitting serves no purpose in base.html and should be corrected and moved to welcome.html (the only place I've seen it used after a cursory search)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions