-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
variables in include tag with liquid filters #1841
Conversation
/cc @maul-esel |
elsif File.symlink?(file) && safe | ||
raise IOError.new "The included file '#{INCLUDES_DIR}/#{@file}' should not be a symlink" | ||
raise IOError.new "The included file '#{INCLUDES_DIR}/#{file}' should not be a symlink" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to use file
to output the real path and not the variable etc. (in case it is one), that's ok. But as file
already contains the full path in this method, you might wanna remove the #{INCLUDES_DIR}
part in this message and the one above 😉
Looks great! Just the one comment above. |
Oh and also, as we discussed in #1789, this fixes cases like |
👍 |
Looking great! Would you please add a test for multiple filters so we know that one works, too? :) |
Do you mean a cucumber test? Specifically I test something like this:
|
Indeed! Thanks. This LGTM. @mattr-? |
Use variable {% include %} with filters
This pull request adds support for filters when using the include tag with a variable.
To be more precise:
Since PR #1495 it is possible to use variables inside an include tag, like that:
but unfortunately you cannot use filters.
With this pull reuqest you can use something like this:
This is especially useful when you want to modify the file/filename which should get included.
Possible use cases
Append
.html
to the file nameMake sure the file name is lowercase
Prepend a directory to choose another directory inside the
_includes/
directory