Site root: Github Pages vs. `jekyll --server`

后端 未结 5 749
走了就别回头了
走了就别回头了 2020-12-24 08:20

When I run jekyll --server my site is available at http://localhost:4000/, but when I deploy to GitHub Project Pages, it\'s available at http

5条回答
  •  -上瘾入骨i
    2020-12-24 09:01

    In the latest version of jekyll (1.1.2) I found it's best to create a separate configuration file from the original. The only difference? The url (or baseurl variable).

    The default _config.yml has:

    url: myurl.com
    

    The new config (lets call it _preview_config.yml):

    url: localhost:4000
    

    This will reassign all your absolute links depending on what configuration you use. Now to run the server with the preview config use:

    jekyll serve -w --config _preview_config.yml
    

    A full explanation is on my blog.

提交回复
热议问题