mirror of
https://github.com/nairobilug/pelican-alchemy.git
synced 2024-12-30 12:15:06 +01:00
Use macro for URLs that may be relative to site root
There are multiple places in the theme where URL value may be either relative to site root or pointing to a third-party resource. Separating the handler logic into a macro makes sense. Now BOOTSTRAP_CSS may contain paths relative to site root - that allows users to apply custom Boostwatch themes without depending on third party resources (custom theme may be included as static file and referenced via relative path).
This commit is contained in:
parent
c66ac71cf7
commit
5251f12a56
1 changed files with 11 additions and 6 deletions
|
|
@ -1,3 +1,12 @@
|
|||
{%- macro url(destination) -%}
|
||||
{%- if destination|lower|truncate(4, True, '') == 'http' or not destination -%}
|
||||
{{ destination }}
|
||||
{%- elif destination|first == '/' -%}
|
||||
{{ SITEURL + destination }}
|
||||
{%- else -%}
|
||||
{{ SITEURL + '/' + destination }}
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
<!doctype html>
|
||||
<html lang="{{ DEFAULT_LANG }}">
|
||||
|
||||
|
|
@ -17,16 +26,12 @@
|
|||
<meta name="theme-color" content="#333333">
|
||||
{% endif %}
|
||||
|
||||
<link rel="stylesheet" href="{{ BOOTSTRAP_CSS or SITEURL + '/theme/css/bootstrap.min.css'}}">
|
||||
<link rel="stylesheet" href="{{ url(BOOTSTRAP_CSS or '/theme/css/bootstrap.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ SITEURL }}/theme/css/font-awesome.min.css">
|
||||
<link rel="stylesheet" href="{{ SITEURL }}/theme/css/pygments/{{ PYGMENTS_STYLE|default('default') }}.min.css">
|
||||
<link rel="stylesheet" href="{{ SITEURL }}/theme/css/theme.css">
|
||||
{% for stylesheet in THEME_CSS_OVERRIDES or () %}
|
||||
{% if stylesheet|lower|truncate(4, True, '') == 'http' %}
|
||||
<link rel="stylesheet" href="{{ stylesheet }}">
|
||||
{% else %}
|
||||
<link rel="stylesheet" href="{{ SITEURL + '/' + stylesheet }}">
|
||||
{% endif %}
|
||||
<link rel="stylesheet" href="{{ url(stylesheet) }}">
|
||||
{% endfor %}
|
||||
|
||||
{% include 'include/xml_feeds.html' %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue