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

basePath #3

Closed
daviddias opened this issue Oct 14, 2015 · 5 comments
Closed

basePath #3

daviddias opened this issue Oct 14, 2015 · 5 comments

Comments

@daviddias
Copy link

Hi @kennethormandy , great work on getting this ghost like blog together with harp!

I saw that you have a note for setting up basePath automatically here, is this something that is easily done with harp?

I'm interested to know if it would be possible to pregenerate the whole collection of html files in advance and also the ones for views like by /tags/* /year/ and so on, without breaking paths of assets being included (which would require for each of this views to have a different relative path preprended)

One option would be to always use root path, but that option doesn't work for me, as I need to have custom paths where the webpages will be hosted in, such as domain.com/blog1/

Thank you!

@kennethormandy
Copy link
Owner

Hey, thanks!

The basePath was a thing I was experimenting with. In the end, I think it’s best to just use paths relative to the root of the site, which should still work in the case of /blog1/, right?

Harp doesn’t generate any pages, you can see how we ended up dealing with that for tags on the Baseline boilerplate, but I think another good approach is to output everything onto one page and re-format it client side if you want using something like List.js

Let me know if that’s helpful at all.

@daviddias
Copy link
Author

The basePath was a thing I was experimenting with. In the end, I think it’s best to just use paths relative to the root of the site, which should still work in the case of /blog1/, right?

In my use case, since I can't tell beforehand if it is going to be /blog1/ or /blog9000/, referring by the root wouldn't work. It would be really nice if the precompiling step would be able to figure out which basePath to put, depending on where the file is being put.

I like the approach that you generated custom pages for each tag (e.g /tags/code.html) and link then to the right path. This could work and save the day.

@kennethormandy
Copy link
Owner

Can you give me more details about the /blog1 to /blog9000 thing? Are these all the same site, or a number of Harp sites in different directories on the same domain? Could they just be config in the harp.json file?

@daviddias
Copy link
Author

It's more of number of Harp sites in different directories on the same domain. The plan is to host them in IPFS which means they will be accessible in one of two ways:

  • ipfs.io/ipfs/HASH and this hash is the hash of the entire blog (or a IPNS hash)
  • a.domain.com/ which will point to a IPFS gateway

@edrex
Copy link

edrex commented Oct 16, 2015

@diasdavid: the only way to handle a site being in an abitrary (unknown at build time) directory is to make sure all intrasite links are generated relative to the current document.

@amitkeret posted a Jade helper for generating relative links sintaxi/harp#46 (comment). Using that helper whenever you're spitting out a path in a template should make the site robustly relative.

Intralinks embedded in site content also need to use relative URLs. Extra care must be taken if post excerpts are included on index pages. Either:

  • Index pages must be accessed always with a trailing slash, so that they are on the same level as the posts they index (eg, /blog/ and /blog/omg-new-product)
  • Links in excerpts must be avoided, either through editorial care or by scrubbing them.

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

No branches or pull requests

3 participants