Support URLs that don't start with `/static/`
See original GitHub issueIn template_tags.py#L19
a TODO
says exactly that.
I’d like to tackle this one, as we need it in one of our projects.
Do you have any hints on how to do this? Introduce a config setting, and if present use that as a base url for static assets? Did you have any concrete plans/ideas on how to implement this?
I wonder if it would be a good idea to reuse django’s STATIC_ROOT
related capabilities (or rather the collectstatic
contrib to be exact) for that.
But this would somehow contradict the item on the roadmap (see #117) which states/asks, that other template engines than Django’s would be a nice feature.
Issue Analytics
- State:
- Created 8 years ago
- Comments:7
Top Results From Across the Web
Dynamic URLs vs. static URLs | Google Search Central Blog
A static URL is one that does not change, so it typically does not contain any URL parameters. It can look like this:...
Read more >Why You Should Avoid Dynamic URLs - codeburst
Static URLs do not accept string parameters and are not dynamically generated. This means that the only way to modify the content of...
Read more >When to use static urls and when dynamic urls [closed]
I want my web-site to be SEO-ed and for which I will be using static URLs (RESTful web services). But in some scenarios,...
Read more >Dynamic URLs vs. Static URLs - The Best Practice for SEO is ...
Providing search engines with dynamic URLs should be favored over hiding parameters to make them look static. The fundamental problem here is ...
Read more >The Complete Guide on Structuring Your URLs Correctly
Dynamic URLs change and include parameters. Static URLs stay the same as long as no changes are made within the HTML. They are...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We went the route of implementing a simple plugin, that reads an optional
config.json
file and given that file contains a key namedstatic_base_url
sets the template variableSTATIC_URL
to the respective value.This also allowed us to maintain most of our cactus v2 templates unchanged.
The following is the plugin code, which you are free to use as is.
… and a sample
config.json
I’ll close this issue, as I’ll not put any further work into it. Sorry, for keeping it open for so long, without any update.
The plugin does not work with the
{% static %}
tamplate tag