Skip to content
This repository has been archived by the owner on Apr 16, 2020. It is now read-only.

Handling multiple paths for the same content #31

Open
daviddias opened this issue Oct 10, 2015 · 1 comment
Open

Handling multiple paths for the same content #31

daviddias opened this issue Oct 10, 2015 · 1 comment
Labels

Comments

@daviddias
Copy link
Collaborator

I'm trying to understand what would be the best way to handle multiple paths for the same content, so that we can have static generated blog posts that still fulfil the same expectations when it comes to URLs from the blogs we use today. Posting it here as I think it makes sense.

In a traditional blog, we would a HTTP router with something similar to the following table:

GET /                      -> Return the main page
GET /:slug-name            -> Return the blog page that has a given slug-name
GET /:tag                  -> Return all the blog posts that have a given tag
GET /:year/:month/:day     -> Return all the blog posts that have a specific year/month/day date
...

Each of this generated pages (or rendered on the fly) would use a strategy to link files such as fonts and css through the "/" (root path of the server), otherwise, using relative paths would create a mess depending on the path they were loaded.

Optimistically, we would be able to support blogs hosted in IPFS, accessible through their IPFS our IPNS hash plus the ones hidden behind DNS. ipfs.io/ipfs/Qm.., ipfs.io/ipns/Qm.. and blog.domain.com should be able to load the page with no problem.

Ideas of how to make this happen nicely?

After giving it some thought, I believe one way we can do it is making that the IPFS node understand that a GET request from a ipfs.io/ipfs/Qm.. to some request /img/img1.jpg would not mean to fetch the image from ipfs.io/img/img1.jpg, but actually ipfs.io/ipfs/Qm../img/img1.jpg. So this way, we could always use the / referencing in resources for the page and have copies or symlinks of the files in different directions to give the 'illusion' it is dynamic.

@jbenet
Copy link
Collaborator

jbenet commented Oct 11, 2015

I believe one way we can do it is making that the IPFS node understand that a GET request from a ipfs.io/ipfs/Qm.. to some request /img/img1.jpg would not mean to fetch the image from ipfs.io/img/img1.jpg, but actually ipfs.io/ipfs/Qm../img/img1.jpg. So this way, we could always use the / referencing in resources for the page and have copies or symlinks of the files in different directions to give the 'illusion' it is dynamic.

this is basically what the baseurl tag does. but it's considered harmful. It may be easiest to just use a static pre-processor and clean up the links? (making them relative).

Another meh option is to link to the static folder from every content directory, so static/foo.css always works in those.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants