问题
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