Kahn
Kahn

Reputation: 149

Permalink to External Site with YAML Front Matter

Is it possible to set a permalink to an external site within YAML front matter? I am currently using Jekyll, and I am not finding any information using my Google-Fu.

---
layout: full-width
title: TEST
permalink: https://somethingexternal.example
---

Can permalink break out of it's context and head to somethingexternal? I just want the TEST link to appear on the home page, but when clicked, to go to somethingexternal.example.

[edit]: What happens is that it prepends the webroot to the site, which is the expected behavior. So it ends up like:

mysite.blah/https://somethingexternal...

I just need to break out of it, so that it only goes to the external site. I don't know if permalink can do that, though.

Upvotes: 1

Views: 632

Answers (1)

marcanuy
marcanuy

Reputation: 23972

Using permalinks for an external link won't work, permalinks aren't for that.

What you are looking for is to define a custom URL in front matter and then access it's value from the page like this:

---
othersite: http://example.com
---

<a href="{{page.othersite}}">visit other site</a>

Upvotes: 2

Related Questions