Git Product home page Git Product logo

Comments (5)

ludovicchabant avatar ludovicchabant commented on August 22, 2024

Hi, why do you need relative URLs exactly?

from piecrust2.

HendrikF avatar HendrikF commented on August 22, 2024

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.

ludovicchabant avatar ludovicchabant commented on August 22, 2024

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.

HendrikF avatar HendrikF commented on August 22, 2024

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.

ludovicchabant avatar ludovicchabant commented on August 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.