Running jekyll generated files without jekyll / local server?

I just started working with Jekyll. As a third-party developer, I have to create many static pages for web applications before they begin development.

I am trying to run jekyll generated files inside a folder _sitewithout a server, as once as part of my workflow, I have to send simple static HTML files to another development team or show to clients during the presentation (sometimes like zip, so I can’t hard-code any or a specific path in the configuration file).

I cannot run jekyll files from a local folder, for example file:///C:/Users/, since all links and assets work only on the jekyll server.

Is there a way this can be achieved.

thank

+8
source share
3 answers

You can view the built Jekyll site without a server, but this requires an additional tool.

Serve your Jekyll site as usual and use wget to clone the served site in flat format. This will work on a Linux system:

  • Serve Jekyll Website
  • Open a new terminal, create & go to the target directory
  • Run wget from this directory
  • Send the received catalog to your client

You may have to play around with wget settings, but if your site is served through port 4000, you can try something like this:

wget --convert-links -r http://127.0.0.1:4000/

You should probably be careful with a recursive flag. See http://www.gnu.org/software/wget/

+9

Jekyll, (/index), URL (/posts/about). , URL- , CSS Javascript, . "../css/...", "./css/". .

, :

  • "." url. , "./css/". , ( "../')

    jekyll serve --baseurl .
    
  • URL. , _site , .

    jekyll serve --baseurl $(pwd)
    
  • . ( , _site), jekyll . python, , python.

    python -m SimpleHTTPServer <port>
    
+6

: , . .

:

Github

Github Pages, . , Octopress, html .

Jekyll ()

baseurl _config.yml.

C:/Users/toto/mysite, :

# No trailing slash
baseurl: "file:///C:/Users/toto/mysite"

Jekyll :

<link rel="stylesheet" href="{{ "/css/main.css" | prepend: site.baseurl }}">
or
<script src="{{ site.baseurl }}/assets/javascripts/script.js"></script>

baseurl :

# html link
<a href="{{ site.baseurl }}{{ page.url }}">{{ page.title }}</a>

# markdown link
[{{ page.title }}]({{ site.baseurl }}{{ page.url }})

# html image
<img src="{{ site.baseurl }}/assets/myimage.png">

# markdown image
![Img title]({{ site.baseurl }}/assets/myimage.png)

Note. Any page with permalinkends with folder/index.html (for example:) permalink: /about/will lead to targeting the link folder/and lands on the page listing files folder.

Try an exotic solution for Win users

You can try Portable Jekyll , which seems to work on windows .

+2
source

All Articles