Pelican: SITEURL should be without protocol (no http://)

Created on 15 Nov 2014  Â·  17Comments  Â·  Source: getpelican/pelican

By using http:// in SITEURL, the page are generated with http hard-link, which does not let the user switch to https protocol (if wanted).

The page can be loaded in https, but all links, referals, pictures... are in http.

All 17 comments

The relevant line in my settings file is:

SITEURL = https://example.com

So I don't see the problem. Perhaps you can be more explicit?

I think what @22decembre means is that some people prefer to use HTTPS if available and by setting SITEURL we prevent them from freely choosing either HTTP or HTTPS, they will have to use the protocol in the links.

However, it can be worked around by having two pelicanconf.py files for both protocols and generate a site for each.

Another possible solution is to use RELATIVE_URLS.

So I don't think this is bug, but we could resolve this issue by adding a FAQ entry listing these two approaches to the problem.

In no particular order:

  1. Perhaps I'm having an obtuse day, but I still don't understand the perceived issue and don't feel inclined to do much of anything until the OP adds sufficient detail.
  2. If a site is available over HTTPS, why would anyone willingly choose HTTP?
  3. FAQs are for frequently-asked questions. I'm not sure that this qualifies.

While your argument about no reason to prefer HTTP over HTTPS is a valid one, I've encountered situations where e.g. the server's certificate was expired or wrong and I had to switch to HTTP.

Switching between the protocols certainly are edge cases. The workarounds I describe above suffice IMHO, I don't really see how a static generator can create protocol agnostic absolute links anyways. Wouldn't you say @22decembre ?
As for th FAQ, I'm just wondering whether we should document it and where.

on my website, I have a cacert cert, thus I want to allow people to come and choose whether they use http or https. In that case, it makes sense : Cacert is not known everywhere (I don't know if my parents, who are common visitors of my blog, know Cacert or if they have it in their browser).

To address that particular problem, I customized my current template to show a logo saying «I use cacert, you can visit with https». This is available in the pelican-theme github now, and in use there :

www.22decembre.eu

On relative_links… I don't know. Maybe the solution indeed. In any matter this option should be better explained.

and relative_url is marked for dev' purpose. Right ? Will it work on a full website ?

Do you utilize Atom/RSS feeds? If not, you can probably get away with not specifying SITEURL at all, which should essentially give you what you want.

I use rss yes. I believe it's not the solution.

Why not making everything available with just 'www.site.url' ?

Most standards (feeds do IIRC) require a fully qualified URL, including the the protocol.

ok, so indeed a bit hard to make it agnostic yes...

No idea or solution.

What happens if you set SITEURL using a scheme-independent URL?

SITEURL = "//example.com"

In my testing, that behaves as expected.

@justinmayer : it seems to work ! Maybe it should be better explained in the doc and/or recommanded !

For what it's worth, this is a well-established, universal convention.

For more information, refer to: http://www.paulirish.com/2010/the-protocol-relative-url/

yet, it's only the second time I hear about it ! (the first time being a buggy blog, hence aking it a bit less accurate ... :-s )

I just figure out that rss aggregators does not like the setup... :-S

can we close this?

@ingwinlu: Yes. Thanks for the reminder.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Kristinita picture Kristinita  Â·  8Comments

Moini picture Moini  Â·  6Comments

kiljungsub picture kiljungsub  Â·  6Comments

jkarimi91 picture jkarimi91  Â·  6Comments

begueradj picture begueradj  Â·  7Comments