14.5k views
5 votes
How can you access a section file's settings outside of that section?

a) Using the {% section.settings.setting_id %} Liquid drop anywhere
b) Using the {% section[header].settings.setting_id %} Liquid drop anywhere
c) Passing the section's setting into a snippet file using a custom variable
d) You can'tΓÇöit's best to use global settings for theme-wide options.

User Rogier
by
9.1k points

1 Answer

5 votes

Final answer:

To access a section file's settings outside of that section, you can pass the section's setting into a snippet file using a custom variable in Liquid.

Step-by-step explanation:

To access a section file's settings outside of that section, you can use the option c) Passing the section's setting into a snippet file using a custom variable. In Liquid, you can pass the section's setting as a parameter to a snippet file and then use that variable to access the settings. Here's an example:

{% raw %}{% include 'snippet-file' with 'section.settings.setting_id' %}{% endraw %}

This will allow you to access the section file's settings from within the snippet file.

User Ngoctranfire
by
9.3k points