diff options
author | 2022-10-29 10:37:45 +0800 | |
---|---|---|
committer | 2023-05-06 11:04:36 +0200 | |
commit | a34ebfa67838acac9f2651d7eba7a7472a4bd4ec (patch) | |
tree | 5c156ae5da1e893f584108c52a9ac6072f72865c | |
parent | Edit on GitHub link instead of button (diff) |
Use content articles source url in django.conf.settings
-rw-r--r-- | pydis_site/apps/content/templatetags/page_src.py | 3 | ||||
-rw-r--r-- | pydis_site/settings.py | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/pydis_site/apps/content/templatetags/page_src.py b/pydis_site/apps/content/templatetags/page_src.py index 33f24b82..3a8f1e8b 100644 --- a/pydis_site/apps/content/templatetags/page_src.py +++ b/pydis_site/apps/content/templatetags/page_src.py @@ -1,4 +1,5 @@ from django import template +from django.conf import settings register = template.Library() @@ -16,7 +17,7 @@ def page_src_url(request_path: str) -> str: """ src_url = request_path.replace( "/pages/", - "https://github.com/python-discord/site/tree/main/pydis_site/apps/content/resources/", + settings.CONTENT_SRC_URL, ) src_url = src_url[:-1] + ".md" return src_url diff --git a/pydis_site/settings.py b/pydis_site/settings.py index e9e0ba67..9da9a156 100644 --- a/pydis_site/settings.py +++ b/pydis_site/settings.py @@ -332,3 +332,8 @@ REDIRECTIONS_PATH = Path(BASE_DIR, "pydis_site", "apps", "redirect", "redirects. # How long to wait for synchronous requests before timing out TIMEOUT_PERIOD = env("TIMEOUT_PERIOD") + +# Source files url for 'Edit on GitHub' link on content articles +CONTENT_SRC_URL = ( + "https://github.com/python-discord/site/tree/main/pydis_site/apps/content/resources/" +) |