Reputation: 449
I'd like to add <link>
s to the <head>
of each of my blog post pages pointing to the next and previous blog posts, e.g. <link rel="next" href="/blog/my-article/"/>
. This will enable flip ahead browsing.
I could use custom front-matter, setting "previousurl" and "nexturl" for each page, and then use those to set the <link>
s in the default layout. However, I don't want to have to maintain these links by hand, and I'm not able to use page variables in the YAML front matter. Is there another way to accomplish this?
Upvotes: 1
Views: 124
Reputation: 449
I feel stupid: you can use the page variable, even on the default layout page. So I ended up doing:
<link rel="prev" href="{{ page.next.url }}" />
<link rel="next" href="{{ page.previous.url }}" />
Upvotes: 2
Reputation: 23637
You might be able to do it using Liquid assign variables.
{% assign variable = value %}
Upvotes: 0