Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Output the page URL in Jekyll?

Tags:

jekyll

How can I get the current page's URL?

I have tried:

{{ site.url }}

But this fails to out put anything.

like image 478
panthro Avatar asked Apr 22 '16 14:04

panthro


1 Answers

You need to define that in your _config.yml.

It's empty by default.

Once defined you might want something like {{site.url}}{{page.url}} to get the whole path.

To capture the whole path in a variable you can use

{% capture url_path %}{{site.url}}{{page.url}}{% endcapture %}

like image 160
michaPau Avatar answered Sep 20 '22 17:09

michaPau