Christian
Christian

Reputation: 7131

Jekyll: output of liquid tags / variables

I try to render something like this:

{% highlight ruby %}
  {{ page.url }}
{% endhighlight %}

The Raw tag doesn't have an effect:

{% highlight ruby %}
 {% raw %}
  {{ page.url }}
 {% endraw %}
{% endhighlight %}

Even not when I put this in my plugins folder: https://gist.github.com/phaer/1020852

I have tried this also:

<pre>
{% raw %}
    {{page.url}}
{% endraw %}
</pre>

But in all cases the page.url does show up.

I also tried tipp #1 here: http://truongtx.me/2013/01/09/display-liquid-code-in-jekyll/

To be clear i want to see the literal here. In fact the real use case is to show some javascript like this:

var disqus_identifier = '{{page.dsq-id}}';

When I use the { entities they are shown as entites and not as brackets.

Only this works, but then my code highlighting is gone:

<pre>
var disqus_identifier = '&#123;&#123;page.dsq-id&#125;&#125';
</pre>

I use jekyll 1.4.2.

Any ideas how i can solve this?

Upvotes: 2

Views: 1072

Answers (1)

Hossain Mohd Faysal
Hossain Mohd Faysal

Reputation: 817

I tried your code in Jekyll 1.2.1 and it works as you've expected it to work.

To uninstall Jekyll 1.4.2 and reinstall Jekyll 1.2.1 run these commands,

gem uninstall jekyll
y
gem install jekyll -v 1.2.1

Upvotes: 1

Related Questions