Skip to content

Commit 38ca2e9

Browse files
Salar Nosrati-Ershadsnosratiershad
authored andcommitted
fix: use relative urls when github publish enabled
docs: add doc about enabling relative urls when github
1 parent 3c69dc6 commit 38ca2e9

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

docs/settings.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ This would save your articles into something like
496496
Defines whether Pelican should use document-relative URLs or not. Only set
497497
this to ``True`` when developing/testing and only if you fully understand
498498
the effect it can have on links/feeds. The default is ``False``.
499+
This option is enabled by default if you use github pages.
499500

500501
.. data:: ARTICLE_URL
501502

pelican/tools/templates/Makefile.jinja2

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ ifeq ($(DEBUG), 1)
4646
PELICANOPTS += -D
4747
endif
4848

49+
{% if github %}
50+
RELATIVE ?= 1
51+
{% else %}
4952
RELATIVE ?= 0
53+
{% endif %}
54+
5055
ifeq ($(RELATIVE), 1)
5156
PELICANOPTS += --relative-urls
5257
endif

pelican/tools/templates/publishconf.py.jinja2

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ from pelicanconf import *
99

1010
# If your site is available via HTTPS, make sure SITEURL begins with https://
1111
SITEURL = "{{siteurl}}"
12+
13+
{{ if github }}
1214
RELATIVE_URLS = False
15+
{{ else }}
16+
RELATIVE_URLS = True
17+
{{ endif }}
1318

1419
FEED_ALL_ATOM = "feeds/all.atom.xml"
1520
CATEGORY_FEED_ATOM = "feeds/{slug}.atom.xml"

0 commit comments

Comments
 (0)