Pelican: How about getting rid of 'siteurl' value in internal links?

Created on 16 Oct 2018  ·  6Comments  ·  Source: getpelican/pelican

How about getting rid of 'siteurl' value in internal links, so we could distinguish between internal links and external links by CSS. (eg. a[href^=http] {....})

Most helpful comment

FYI, your SITEURL can also be protocol relative ('//example.com') or root relative ('', '/blog', etc.)

All 6 comments

RELATIVE_URLS =True

I see your point, @avaris, but I'm afraid it causes lots of '../..' things.
I'd like to keep href property tidy.

You can refer internal links to other articles using the {filename} variable.
Additionally (depending on host and site setup), statics can be referred to from root ('/') if specified in STATIC_PATHS and EXTRA_PATH_METADATA.

Also consider that a difference between internal and external links, is internal links refer to the site in the siteurl. So you could try CSS like:

a[href^={{ SITEURL }}/] {....}

though you would have to put this in a <style> tag within the base file of the theme, or maybe in your articles / pages.

FYI, your SITEURL can also be protocol relative ('//example.com') or root relative ('', '/blog', etc.)

a[href^={{ SITEURL }}/] {....}

Problem solved!
Thanks! :-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chenjiandongx picture chenjiandongx  ·  3Comments

Moini picture Moini  ·  6Comments

Kristinita picture Kristinita  ·  8Comments

soulchainer picture soulchainer  ·  7Comments

therealmaxmoon picture therealmaxmoon  ·  8Comments