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

Option to generate relative image links in output #440

Closed
msgilligan opened this issue Mar 30, 2018 · 7 comments
Closed

Option to generate relative image links in output #440

msgilligan opened this issue Mar 30, 2018 · 7 comments
Milestone

Comments

@msgilligan
Copy link

msgilligan commented Mar 30, 2018

I want to generate an output site file tree that has relative links to the images. I don't want to use server mode -- I want an accurate preview loading from file:// URLs. I also want the option to post to a staging and production server (using Gitlab CI) so the image links shouldn't be hardcoded to the production server.

But the images are pulled from the previously published version of the site running on site.host.

According to the documentation site.host should contain the URL of the server and is overridden for server mode. But there appears to be no (easy) way to request the generation of relative image links in the output.

I'm in the process of updating to JBake 2.6.0.

Note jbake-org/jbake-gradle-plugin#32 -- Gradle plugin doesn't support server mode.

@manikmagar
Copy link
Member

Thanks for raising this issue.

With 2.6.0, the image URL generation has changed (you may have already seen this). This change skips the images where URL explicitly starts with http:// or https://. I think the initial version of change also excluded modifying image URLs starting with /. I wonder if that would have helped to achieve this setup.

Were you able to achieve all this with 2.5.1 where image path's are not modified?

Running in server mode could be used while testing site in local.

@msgilligan
Copy link
Author

msgilligan commented Mar 31, 2018

I think the initial version of change also excluded modifying image URLs starting with / . I wonder if that would have helped to achieve this setup.

I don't think that will help. For example if the file is in /blog/2018. And what happens when you want to preview from a file:// URL from some subdir of your home directory.

Were you able to achieve all this with 2.5.1 where image path's are not modified?

I don't remember what was happening with 2.5.1 (I either wasn't having a problem or links were to existing images that were already on the http:// links on the server). I upgraded to 2.6.0 to get a few of the new features.

Running in server mode could be used while testing site in local.

Gradle plugin doesn't support server mode: jbake-org/jbake-gradle-plugin#32

@ancho
Copy link
Member

ancho commented Mar 31, 2018

@msgilligan see my comment on how to use gretty plugin with gradle to serve a baked site.
If I find some time I will think about the direct browser solution you prefer.

For testing, staging, production scenario have a look at my website project on how to work with different environments https://github.com/ancho/calmdev-website/blob/master/gradle/environment.gradle

Hope that helps a bit.

@msgilligan
Copy link
Author

Thanks @ancho, I may try that.

@msgilligan
Copy link
Author

How hard would this be to fix? Is it something that could be easily submitted as a PR?

@msgilligan
Copy link
Author

msgilligan commented Apr 17, 2018

@jonbullock It seems to me a static site generator should be able to generate fully static sites that:

  1. Are entirely self-contained
  2. Can be opened and navigated by opening index.html in any directory on the file system (via a file: URL - and thereby serving as effective "root" for the site.)
  3. Can be deployed to multiple servers on multiple URLs without any modification.

Any suggestions on what we can do got get his fixed? I'm willing to help if given some guidance and this is not too difficult.

manikmagar added a commit to manikmagar/jbake that referenced this issue Apr 24, 2018
@jonbullock
Copy link
Member

Haven't reviewed the changes in #459 properly yet but @manikmagar comment on #455 sounds like it would address this issue too.

I'll review it ASAP and look to get it out in a 2.6.2 release.

@jonbullock jonbullock added this to the v2.6.2 milestone Apr 25, 2018
jonbullock pushed a commit to jonbullock/jbake that referenced this issue Aug 28, 2018
jonbullock pushed a commit to jonbullock/jbake that referenced this issue Aug 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants