LoginSignup
2
1

More than 5 years have passed since last update.

Jekyllで変数と文字列を連結する方法

Posted at

Jekyllのhtml内でページ変数に別の文字列を付加して使いたい時に下記のように普通に連結しようとしても認識されない。

{% assign new_var = page.id + '_hogehoge' %}

文字列を連結したい場合はcaptureというロジックを用いるようです。

{% capture new_var %}{{page.id}}_hogehoge{% endcapture %}

これで新しい文字列を変数にセットすることが出来ました。

via: http://stackoverflow.com/questions/23688939/contatenate-append-a-string-to-another-one-in-jekyll-liquid

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1