Created
May 9, 2019 17:21
-
-
Save illvart/ab4e2a51029fb470bac8b839bbd2ef81 to your computer and use it in GitHub Desktop.
Meta schema JSON on Eleventy by nunjucks include, set, filter, custom tags.
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
<script type="application/ld+json"> | |
{% minifyJson %} | |
{ | |
"@context": "https://schema.org", | |
"@type": "WebSite", | |
"url": "{{ metadata.url }}", | |
"potentialAction": { | |
"@type": "SearchAction", | |
"target": "{{ metadata.url }}/search?q={search_term_string}", | |
"query-input": "required name=search_term_string" | |
} | |
} | |
{% endMinifyJson %} | |
</script> | |
<script type="application/ld+json"> | |
{% minifyJson %} | |
{ | |
"@context": "http://schema.org", | |
"@type": "Person", | |
"name": "{{ metadata.title }}", | |
"url": "{{ metadata.url }}", | |
"sameAs": [ | |
"{{ metadata.author.social.facebook }}", | |
"{{ metadata.author.social.twitter }}", | |
"{{ metadata.author.social.github }}" | |
] | |
} | |
{% endMinifyJson %} | |
</script> |
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
{% set search %}{% include "json/search.njk" %}{% endset %} | |
{% set social %}{% include "json/social.njk" %}{% endset %} | |
<script type="application/ld+json"> | |
{{ search | minifyJson | safe }} | |
</script> | |
<script type="application/ld+json"> | |
{{ social | minifyJson | safe }} | |
</script> |
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
{% set search %} | |
{ | |
"@context": "https://schema.org", | |
"@type": "WebSite", | |
"url": "{{ metadata.url }}", | |
"potentialAction": { | |
"@type": "SearchAction", | |
"target": "{{ metadata.url }}/search?q={search_term_string}", | |
"query-input": "required name=search_term_string" | |
} | |
} | |
{% endset %} | |
<script type="application/ld+json"> | |
{{ search | minifyJson | safe }} | |
</script> | |
{% set social %} | |
{ | |
"@context": "http://schema.org", | |
"@type": "Person", | |
"name": "{{ metadata.title }}", | |
"url": "{{ metadata.url }}", | |
"sameAs": [ | |
"{{ metadata.author.social.facebook }}", | |
"{{ metadata.author.social.twitter }}", | |
"{{ metadata.author.social.github }}" | |
] | |
} | |
{% endset %} | |
<script type="application/ld+json"> | |
{{ social | minifyJson | safe }} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment