Comments (5)
Hi, why do you need relative URLs exactly?
from piecrust2.
I wanted to publish my site in IPFS.
The site would there be available at, say /ipfs/[insert hash here]/
, so a slash would just not work.
For this to work, one would have to use relative url (like ../assets/script.js) to reference files in a parent directory.
from piecrust2.
Huh, interesting, I didn't know about IPFS, thanks for that :)
From what I can tell it doesn't look like you need relative URLs though? I mean you could, just like you could in the HTTP world, but you can also use a site root of /ipfs/<hash>/
, like you would with a site root of https://example.org/
, no? Or maybe I'm missing something (I'm still trying to wrap my head around this).
I had relative URLs like you mention a long time ago but I removed it because it basically completely fucks up caching and, therefore, performance. For instance, imagine you have a blog post that references some "about" page with pcurl('/about')
... depending on whether that blog post is rendered in, say, sub-page 6 of your home page, or its own blog post page, or the 2015 blog archive page's second sub-page, then the relative path to the "about" page could be different, which means the same blog post's text must be re-rendered differently each time (potentially).
So yeah, I cut that feature a long time ago and don't want to add it back, sorry.
from piecrust2.
It is not possible to use the hash as the sites root, because the files content will be part of the hash. By inserting the hash, you would change it.
(You would have to break sha256 for this to work :) )
I don't see how it would break caching.
You just have to know where you are generating the path to a file to be able to generate the relative path.
Its ok you closed this, as I don't really have the time to play with piecrust. Just thought it would be a nice feature. I may come back to this later.
from piecrust2.
It breaks caching because a link from some post to another post will end up having to be rendered differently between the post itself (at /myblog/YEAR/MONTH/SLUG.html
), the home page (at /myblog/page3
), the various tag listing pages that this post might appear on (/myblog/tags/FOO
), and so on. So we can't render the post once and re-use the cached result in all those places.
from piecrust2.
Related Issues (20)
- Site/Root variable including tilde results in URI error upon baking HOT 2
- Assets not processed HOT 5
- How to handle pages with "more" link HOT 1
- Can't get children to work properly HOT 4
- Trying to run FoodTruck HOT 4
- pip install not working HOT 2
- "python2" and python3 compatiblity(at the same time) of Piecrust2 HOT 2
- Missing attributes and unexpected keyword HOT 5
- Sass sourcemaps HOT 1
- Current entry already exists HOT 2
- site.root contains "/" even when set to "" HOT 3
- dashboard.html template not found HOT 2
- "chef init mywebsite" encounter error,how to fix it? HOT 3
- Include "wheel" in depenencies HOT 4
- Prebuild assets HOT 1
- PieCrust 3.2.1. appears to not make pages correctly HOT 1
- PieCrust admin doesn't work with Flask 1.0 HOT 1
- Unable to use Source functions in Jinja macros
- bake could not find pagination HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from piecrust2.