-
Notifications
You must be signed in to change notification settings - Fork 2
Snippets
klauBertram edited this page Jul 16, 2014
·
2 revisions
What are snippets? Snippets are chunks of content that can be reused across many pages. A good example of a snippet might be a footer area that you would like the administrator to have access to make adjustments. Or maybe a sidebar section with a sponsors list.
By default, snippets are enabled when installing the latest version of spud_cms. You can turn them off by adjusting the configuration:
Spud::Cms.configure do |config|
config.snippets_enabled = false
end
Snippets can be injected into your site multiple ways. The first way is to inject them with a helper directly into your layouts or other erb/haml views with sp_snippet('snippet_name')
.
The other way is to use liquid tags in your pages: {% snippet snippet_name %}
Thats all there is to it.