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.
Deploy Jekyll project without a webserver
144 views Asked by Fred K At
2
There are 2 answers
0
On
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">
This is possible only if you know where, in the file system, it will be deployed.
Examples :
Linux
For a deployment in
/home/user/www
, go in_config.yml
and setbaseurl: /home/user/www
Windows
For a deployment in
C:/Users/Toto/www
, go in_config.yml
and setbaseurl: /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 inC:/
.The client will just have to click on
C:/_site/index.html
to start the site in his default browser.