Reputation: 13910
I created a blog with Jekyll and now I need to deploy it and send it to a person that need to navigate it without a web server. So, I entered jekyll build
from terminal and get the compiled project in _site
. But now, if I open index.html it doesn't get the assets (CSS). In the head tag tag there's /css/main.css
while I need css/main.css
(no initial slash). I don't want to change manually the url, so I'm asking if there's a way to deploy a Jakyll project for showing in local without webserver.
Upvotes: 2
Views: 149
Reputation: 3850
Change the assets directory to relative paths such as: assets/css/. This will work on a server or locally.
Set a page variable to represent the nesting in your Yaml front matter. Then, append that variable to your assets.
---
layout: default
title: Nested Page
path: ../
---
or
---
layout: default
title: Root level page
path: ""
---
<link rel="stylesheet" href="{{ page.path }}assets/stylesheets/style.css">
Upvotes: 0
Reputation: 52809
This is possible only if you know where, in the file system, it will be deployed.
Examples :
For a deployment in /home/user/www
, go in _config.yml
and set baseurl: /home/user/www
For a deployment in C:/Users/Toto/www
, go in _config.yml
and set baseurl: /C:/Users/Toto/www
Deployment means copying generated files
in the target folder, not copying the _site
folder.
Do a jekyll build
and send you files with deploy instructions.
Edit:
This answer is for you, not the client.
As you client is certainly running windows, you just set your baseurl: /C:/_site
, zip the _site
folder and ask the client to unzip in C:/
.
The client will just have to click on C:/_site/index.html
to start the site in his default browser.
Upvotes: 1