How to detemine if jekyll running locally or in production site?

前端 未结 4 1746
谎友^
谎友^ 2021-02-13 03:25

There is a config param in jekyll called production_url. I can\'t find any information on how to use it.

Ideally i would like to be able to generate permalinks with loc

4条回答
  •  借酒劲吻你
    2021-02-13 04:08

    When you build your Jekyll website, it’s possible to specify the environment it’s using for the build with the JEKYLL_ENV environment variable:

    $ JEKYLL_ENV=production jekyll build
    

    If you don’t set JEKYLL_ENV explicitly, it defaults to development.

    {% if jekyll.environment == "production" %}
        // Production environment.
    {% endif %}
    

    Github Pages automatically sets the environment to production.

提交回复
热议问题