Create variable to be set in deployment

六眼飞鱼酱① 提交于 2020-12-15 04:54:31

问题


How do I set a variable in jekyll for a link that will be determined by the environment that it's deployed in?

i.e.

If I deploy in sandbox I want {{site.REDIRECT_LINK}} to be set to a different URL than when it's deployed in production.

I'm assuming I set it in the _config file, but is there anything I need to set up for docker?


回答1:


You'll need to set variables in your config file that match your environment names:

staging:
  redirect_link: http://staging.example.com
production:
  redirect_link: http://example.com

Then you can call {{ site[jekyll.environment].redirect_link }}. If you are building in your staging environment you will get "http://staging.example.com"



来源:https://stackoverflow.com/questions/65129379/create-variable-to-be-set-in-deployment

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!