Created
July 3, 2019 16:33
-
-
Save jackmcdade/27392f9907499b9ce1c0cf00d6c76fe9 to your computer and use it in GitHub Desktop.
Statamic Fieldset for Head and Footer Scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
title: 'Site Settings' | |
hide: true | |
sections: | |
main: | |
fields: | |
head_scripts: | |
mode: table | |
fields: | |
description: | |
type: text | |
display: Description | |
code: | |
type: textarea | |
display: Code | |
type: grid | |
instructions: 'Add meta tags and scripts to the `<head>` area of your site.' | |
display: 'Head Scripts' | |
add_row: Add Code | |
footer_scripts: | |
mode: table | |
fields: | |
description: | |
type: text | |
display: Description | |
code: | |
type: textarea | |
display: Code | |
type: grid | |
instructions: 'Add meta tags and scripts right before closing `</body>` area of your site.' | |
display: 'Footer Scripts' | |
add_row: Add Code |
Nice! THANK YOU! 🙏🏻🙏🏻
Also I think line 4 should have a handle title of head_scripts
not grid
? 🤔
Yep, good catch.
Here is the templating I made for it:
// shared/scripts.antlers.html:
{{ globals[scope] }}
<!-- {{ description }} -->
{{ code }}
<!-- end:{{ description }} -->
{{ /globals[scope] }}
// layout.antlers.html:
<head>
{{ partial:shared.scripts scope="head_scripts" }}
</head>
...
{{ partial:shared.scripts scope="footer_scripts" }}
</body>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here it is as a v3 Fieldset.