3
votes

I have a blog/index.html file with a list of blog posts and excerpts. once i click on a blog post, it opens up in a new page in its entirety. I would like to place a "back" button at the end of each post that should go back at the last page you visited.

is there a liquid tag to achieve this?

2

2 Answers

2
votes

Unfortunately there is no liquid tag that you can use. However, you have a choice of placing a link with static destination link like this:

<a href="/blog">Back</a>

Or you can use javascript to take user to the previously visited page

<a onclick="window.history.back()">Back</a>

1
votes

If you want to go back to the site root (edit, thanks coatless). This works.

With markdown:

[Back]({{ site.url }}/)

With HTML:

<a href='{{site.url}}/'>Back</a>

Also check out: https://jekyllrb.com/docs/pagination/