# No absolute url via post\_url?

**URL:** <https://talk.jekyllrb.com/t/no-absolute-url-via-post-url/7254>\
**Category:** Help\
**Created:** [April 21, 2022, 11:21am UTC](https://talk.jekyllrb.com/t/no-absolute-url-via-post-url/7254 "2022-04-21T11:21:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Koos](https://avatars.discourse-cdn.com/v4/letter/k/2acd7d/32.png) [@Koos](https://talk.jekyllrb.com/u/Koos)\
**Post date:** [April 21, 2022, 11:21am UTC](https://talk.jekyllrb.com/t/no-absolute-url-via-post-url/7254/1 "2022-04-21T11:21:22Z")

</div>

The [docs say](https://jekyllrb.com/docs/liquid/tags/#links):

> Since Jekyll 4.0 , you don’t need to prepend `link` and `post_url` tags with `site.baseurl` .

But when I add links in markdown with `{% post_url 2010-07-21-name-of-post %}` or `{% link news/index.html %}`, the output is a relative URL. This is a problem in my RSS feeds, where the links should have absolute URLs.

Is there some config setting I’ve missed?

---

<div class="post-metadata">

**Author:** ![ashmaroli](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@ashmaroli](https://talk.jekyllrb.com/u/ashmaroli)\
**Post date:** [April 22, 2022, 1:32pm UTC](https://talk.jekyllrb.com/t/no-absolute-url-via-post-url/7254/2 "2022-04-22T13:32:48Z")

</div>

There is no need to prepend `site.baseurl` but if you need absolute URLs, you may prepend `site.url`:

```auto
{{ site.url }}{% post_url 2010-07-21-name-of-post %}

```

---

<div class="post-metadata">

**Author:** ![Koos](https://avatars.discourse-cdn.com/v4/letter/k/2acd7d/32.png) [@Koos](https://talk.jekyllrb.com/u/Koos)\
**Post date:** [April 23, 2022, 1:45pm UTC](https://talk.jekyllrb.com/t/no-absolute-url-via-post-url/7254/3 "2022-04-23T13:45:29Z")

</div>

Now I’m confused! The behavior pre Jekyll 4.0 was that `post_url` returned a relative URL. The callout in the docs specifically mentions, 4.0 implying that this has changed. I looked at the issues on Github and happened to see that a user with your nick [says](https://github.com/jekyll/jekyll/issues/8887#issuecomment-973782660):

> The `post_url` and `link` tags prefixes `site.baseurl` from Jekyll 4.0 onward.

I’ll look into this further to find out if it’s somehow caused by my config.

---

<div class="post-metadata">

**Author:** ![mmistakes](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mmistakes/32/2169_2.png) [@mmistakes](https://talk.jekyllrb.com/u/mmistakes)\
**Post date:** [April 23, 2022, 2:35pm UTC](https://talk.jekyllrb.com/t/no-absolute-url-via-post-url/7254/4 "2022-04-23T14:35:35Z")

</div>

How are you generating your feed? With the [Jekyll-feed plugin](https://github.com/jekyll/jekyll-feed)?

I don’t believe it converts relative urls to absolute at least from what I gathered from the closed issues asking for such a feature.

So to get links and assets with relative urls resolving correctly in feeds you’ll need to make them absolute in your content. Unless there’s a clever way around that by modifying the feed plug-in or [Atom layout](https://github.com/jekyll/jekyll-feed/blob/master/lib/jekyll-feed/feed.xml) it uses.

---

<div class="post-metadata">

**Author:** ![Koos](https://avatars.discourse-cdn.com/v4/letter/k/2acd7d/32.png) [@Koos](https://talk.jekyllrb.com/u/Koos)\
**Post date:** [April 23, 2022, 5:56pm UTC](https://talk.jekyllrb.com/t/no-absolute-url-via-post-url/7254/5 "2022-04-23T17:56:17Z")

</div>

I made my own template for the RSS feed.

I could search `<a href="/">` and replace it with `<a href="[my site url]/"`. But that’s clunky, prone to mistakes and, as I understand it, superfluous with the expected behavior or `post_url`.

---

<div class="post-metadata">

**Author:** ![mmistakes](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mmistakes/32/2169_2.png) [@mmistakes](https://talk.jekyllrb.com/u/mmistakes)\
**Post date:** [April 23, 2022, 7:09pm UTC](https://talk.jekyllrb.com/t/no-absolute-url-via-post-url/7254/6 "2022-04-23T19:09:59Z")

</div>

`post_url` produces relative links. It doesn’t perpend your site url before links which is needed to make them absolute and work in feeds. The only way to make them absolute is to add `site.url` before the link, which all your domain to the path.

You might be confusing `site.url` and `site.baseurl` too, they’re two different things.

> **[Jekyll’s site.url and baseurl - Made Mistakes](https://mademistakes.com/mastering-jekyll/site-url-baseurl/)**
>
> Learn what Jekyll's site url and baseurl variables are and how to properly set them with relative\_url and absolute\_url filters to avoid broken links and 404 errors.

---

<div class="post-metadata">

**Author:** ![Koos](https://avatars.discourse-cdn.com/v4/letter/k/2acd7d/32.png) [@Koos](https://talk.jekyllrb.com/u/Koos)\
**Post date:** [April 23, 2022, 7:16pm UTC](https://talk.jekyllrb.com/t/no-absolute-url-via-post-url/7254/7 "2022-04-23T19:16:23Z")

</div>

I just tried with a fresh Jekyll 4.2.2 and there I also only get relative URLs. Thanks for checking everyone! IMO this is either a bug or an issue with the docs.

---

<div class="post-metadata">

**Author:** ![Koos](https://avatars.discourse-cdn.com/v4/letter/k/2acd7d/32.png) [@Koos](https://talk.jekyllrb.com/u/Koos)\
**Post date:** [April 23, 2022, 7:22pm UTC](https://talk.jekyllrb.com/t/no-absolute-url-via-post-url/7254/8 "2022-04-23T19:22:40Z")

</div>

> [@mmistakes](#):
>
> You might be confusing `site.url` and `site.baseurl` too, they’re two different things.

OOHHH gotcha! Damn that’s an unfortunate choice for a variable name. Thanks for the blog post!
