Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use relative urls when github publish enabled #3258

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ This would save your articles into something like
Defines whether Pelican should use document-relative URLs or not. Only set
this to ``True`` when developing/testing and only if you fully understand
the effect it can have on links/feeds.
This option is enabled by default if you use github pages.

.. data:: ARTICLE_URL = '{slug}.html'

Expand Down
5 changes: 5 additions & 0 deletions pelican/tools/templates/Makefile.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ ifeq ($(DEBUG), 1)
PELICANOPTS += -D
endif

{% if github %}
RELATIVE ?= 1
{% else %}
RELATIVE ?= 0
{% endif %}

ifeq ($(RELATIVE), 1)
PELICANOPTS += --relative-urls
endif
Expand Down
5 changes: 5 additions & 0 deletions pelican/tools/templates/publishconf.py.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ from pelicanconf import *

# If your site is available via HTTPS, make sure SITEURL begins with https://
SITEURL = "{{siteurl}}"

{{ if github }}
RELATIVE_URLS = False
{{ else }}
RELATIVE_URLS = True
{{ endif }}

FEED_ALL_ATOM = "feeds/all.atom.xml"
CATEGORY_FEED_ATOM = "feeds/{slug}.atom.xml"
Expand Down