I think I misunderstood the assign tag. It probably needs to be a string in there, like {% assign __align__col = "col-sm-6 col-sm-offset-2 col-md-4 col-md-offset-4" %}
. I'm not using this anyways, so this is probably the best answer I have for this.
Jekyll not setting variable properly in Liquid
-
15-10-2022 - |
Frage
I have been trying to adopt a single set of column styles that are used across my website, but the Liquid assign tag isn't working properly.
I only have one template so far, called default.html:
---
---
<!DOCTYPE html>
<html>
{% include header.html %}
<body>
{% include navbar.html %}
<div class="container">
<div class="row">
{% assign __align__col = col-sm-6 col-sm-offset-2 col-md-4 col-md-offset-4 %}
<p>Using align {{ __align__col }}</p>
<div class="{{ __align__col }}">
<div class="panel panel-default">
{% if page.title %}
<div class="panel-heading">
<h3 class="panel-title">{{ page.title }}</h3>
</div>
{% endif %}
<div class="panel-body">
{{ content }}
</div>
</div>
</div>
</div>
<div class="row">
<div class="{{ __align__col }}">
{% include footer.html %}
</div>
</div>
</div>
</body>
</html>
The problem resides in the {% assign __align__col = col-sm-6 col-sm-offset-2 col-md-4 col-md-offset-4 %}
line, it doesn't seem to set the __align__col
variable. I looked at the source, and it doesn't show up in the class attribute or in the <p>
tag.
I have Bootstrap running to do the UI stuff, and it's hosted over here at GitHub Pages. Actual website is here.
Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow