X Tutup
Skip to content

Commit 75fa188

Browse files
committed
Add ability to dynamically set url paths
This makes GitHub Pages for projects support possible as all urls will need to call on the project's subfolder. The other important piece is that urls should resolve to root locally but be able to change when in production. LLastly this gives themes clear integration points for working with paths. (the jbcache hack just makes it so there is not unnecessary whitespace output in the source.
1 parent 61cdb7a commit 75fa188

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

_includes/JB/set_paths

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{% capture jbcache %}
2+
<!--
3+
Dynamically set liquid variables for working with URLs/paths
4+
-->
5+
6+
{% if site.safe and site.JB.BASE_PATH %}
7+
{% assign BASE_PATH = site.JB.BASE_PATH %}
8+
{% assign HOME_URL = site.JB.BASE_PATH %}
9+
{% else %}
10+
{% assign BASE_PATH = "" %}
11+
{% assign HOME_URL = "/" %}
12+
{% endif %}
13+
14+
{% if site.JB.ASSET_PATH %}
15+
{% assign ASSET_PATH = site.JB.ASSET_PATH %}
16+
{% else %}
17+
{% capture ASSET_PATH %}{{ BASE_PATH }}/assets/themes/{{ page.theme.name }}{% endcapture %}
18+
{% endif %}
19+
20+
{% endcapture %}{% assign jbcache = null %}

0 commit comments

Comments
 (0)
X Tutup