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

Patch to allow relative ASSET_URL #488

Merged
merged 1 commit into from
Sep 25, 2012

Conversation

dmdm
Copy link

@dmdm dmdm commented Aug 27, 2012

Previously, webassets' ASSET_URL always was absolute.
This patch allows a relative ASSET_URL, depending on Pelican's
RELATIVE_URLS setting.

Hint for templates:

Current version of webassets seem to remove any relative
paths at the beginning of the URL. So, if RELATIVE_URLS
is on, ASSET_URL will start with 'theme/', regardless if we
set assets_url here to './theme/' or to 'theme/'.
XXX However, this breaks the ASSET_URL if user navigates to
a sub-URL, e.g. if he clicks on a category. To workaround this
issue, I use
<link rel="stylesheet" href="{{ SITEURL }}/{{ ASSET_URL }}">
instead of
<link rel="stylesheet" href="{{ ASSET_URL }}">

Maybe this hint is worth to be included in the documentation.
I have it also written as comments in the source.

Previously, webassets' ASSET_URL always was absolute.
This patch allows a relative ASSET_URL, depending on Pelican's
RELATIVE_URLS setting.

Hint for templates:
-------------------
Current version of webassets seem to remove any relative
paths at the beginning of the URL. So, if RELATIVE_URLS
is on, ASSET_URL will start with 'theme/', regardless if we
set assets_url here to './theme/' or to 'theme/'.
XXX However, this breaks the ASSET_URL if user navigates to
a sub-URL, e.g. if he clicks on a category. To workaround this
issue, I use
    <link rel="stylesheet" href="{{ SITEURL }}/{{ ASSET_URL }}">
instead of
    <link rel="stylesheet" href="{{ ASSET_URL }}">

Maybe this hint is worth to be included in the documentation.
I have it also written as comments in the source.
@travisbot
Copy link

This pull request passes (merged 0ec0cf9 into 000210d).

@almet
Copy link
Member

almet commented Aug 30, 2012

you have missing text in your explanation (probably due to formatting).

@dmdm
Copy link
Author

dmdm commented Aug 30, 2012

Yes, sorry about that. The examples were HTML tags and github didn't mask them.
Anyway, it's the same text as in the commit message; that one is complete.
Corrected it (visually).

almet added a commit that referenced this pull request Sep 25, 2012
@almet almet merged commit 32429d3 into getpelican:master Sep 25, 2012
@saimn saimn mentioned this pull request Oct 24, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants