Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the point of using absolute urls in Pelican?

About RELATIVE_URLS, the Pelican docs say:

…there are currently two supported methods for URL formation: relative and absolute. Relative URLs are useful when testing locally, and absolute URLs are reliable and most useful when publishing.

(http://pelican.readthedocs.org/en/3.4.0/settings.html#url-settings)

But I'm confused why absolute URLs would be better or not. In general, when I write HTML by hand I prefer to use relative URLs because I can change the domain of the website and not worry about it later.

Can somebody explain the thinking behind this setting in more detail?

like image 287
mlissner Avatar asked Aug 22 '14 16:08

mlissner


1 Answers

I don't use the RELATIVE_URLS setting because it's document-relative. I don't want URLs containing ../.. in them, which is often what happens when that setting is used.

Moreover, relative URLs can cause issues in Atom/RSS feeds, since all links in feeds must be absolute as per the respective feed standard specifications.

Contrary to what's implied in the original question, not using the RELATIVE_URLS setting will not cause any 404s if you later decide to change the domain. There's a difference between specifying absolute URLs in your source document (which is what you seem to be talking about) and having absolute URLs generated for you at build time (which is what Pelican does).

When it comes time to link to your own content, you can either use root-relative links, or you can use the intra-site link syntax that Pelican provides.

like image 60
Justin Mayer Avatar answered Sep 28 '22 05:09

Justin Mayer