We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Mandatory for using variable tags in slate is that you change all .md files to .md.erb. You folder structure can look like:
.md
.md.erb
source/ index.html.md.erb includes/ _want-to-use-var.md.erb
Do not forget to change the include section in the index file. And yes, you can ignore the _ from the include file. Slate needs this only for parsing.
_
includes: - want-to-use-var.md.erb
In config.rb create yourself a new section e.g. Global Variables and add the following lines.
config.rb
# Global Variables set :endpoint, 'https://my.endpoint.com' config[:endpoint]
You have now created a global variables which you can use in your files with the following tag
<%= config[:endpoint] %>
An example for using variables could look like this:
Hello you want to access <%= config[:endpoint] %> !
To access environment variables, ENV can be used in config.rb. For example for a environment variable called MY_VAR:
ENV
MY_VAR
set :my_var, ENV["MY_VAR"] config[:my_var]