General
A list containing all of the accepted arguments. If you can't find what you need, feel free to open an issue and we can get the support added.
Arguments
The following arguments are supported by this plugin for providing general document metadata.
title
The content for:
<title>
<meta name="title">
og:title
twitter:title
If og_title
and twitter_title
are defined, they will take the highest priority and be used for og:title
and twitter:title
url
The content for:
<link rel="canonical">
og:url
twitter:url
If og_url
and twitter_url
are defined, they will take the highest priority and be used for og:url
and twitter:url
name
The content for <meta name="author">
desc
The content for:
<meta name="description">
og:description
twitter:description
If og_desc
and twitter_desc
are defined, they will take the highest priority and be used for og:description
and twitter:description
generator
The content for <meta name="generator">
. The value must be a free-form string that identifies one of the software packages used to generate the document. This value must not be used on pages whose markup is not generated by software, e.g. pages whose markup was written by a user in a text editor.
comments
Display default comments for the Open Graph and Twitter tags.
default: false
preconnect
The href
value for <link rel="preconnect">
. Accepts a string | Array containing strings or objects.
preconnect='https://google.com'
=> <link rel="preconnect" href="https://google.com">
preconnect=[
{url: https://fonts.googleapis.com/, crossorigin: true},
'https://google.com'
]
=>
<link rel="preconnect" href="https://fonts.googleapis.com/" crossorigin>
<link rel="preconnect" href="https://google.com/">
dns_prefetch
The href
value for <link rel="dns-prefetch">
. Accepts a string or an array of strings.
dns_prefetch=https://google.com
=> <link rel="dns-prefetch" href="https://google.com">
dns_prefetch=['foo.com', 'example.com']
=>
<link rel="dns-prefetch" href="https://foo.com">
<link rel="dns-prefetch" href="https://example.com">
robots
The content
value for <meta name="robots">
. Accepts a string of comma separated values.
robots='noindex'
=> <meta name="robots" content="noindex">
robots='noindex, nofollow'
=> <meta name="robots" content="noindex, nofollow">
crawlers
The name
and content
values for <meta name="" content="">
custom crawler tags. Accepts an object containing key value pairs where the key is the crawler name and value is the content. i.e. crawlers={"googlebot": "noindex"}
crawlers={
'googlebot': 'noindex',
'googlebot-news': 'nosnippet'
}
=>
<meta name="googlebot" content="noindex">
<meta name="googlebot-news" content="nosnippet">
css
An array of CSS file strings. to be generated as <link rel="stylesheet" href="">
. E.g. css=["style.css", "foo.css"]
css=["style.css", "foo.css"]
=>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="foo.css">
css=['modals.css', 'icons.css:rel="preload":as="style"']
=>
<link rel="stylesheet" href="modals.css">
<link rel="preload" as="style" href="icons.css">
inline_css
A string or array of strings representing inline styles.
inline_css="h1 {color: #f06;}"
=> <style>h1 {color: #f06}</style>
inline_css=[".foo {color: blue}", "h1:hover {color: blue}"]
=>
<style>.foo {color: blue}</style>
<style>h1:hover {color: blue}</style>
js
A string or array of file strings to be generated as <script>
elements.
js=['foo.js', 'bar.js:async:type="module"', 'fizz.js:defer']
=>
<script src="foo.js"></script>
<script src="bar.js" async type="module"></script>
<script src="fizz.js" defer></script>
inline_js
A string or array of strings or objects to be generated as <script>
elements inline_js="console.log('hello world');"
inline_js='console.log(123);'
=> <script>console.log(123);</script>
inline_js=[
'console.log("hello, world");',
{type: 'application/json', id: 'some-id', js: '{"data": "hello"}'}
]
=>
<script>console.log("hello, world");</script>
<script type="application/json" id="some-id">{"data": "hello"}</script>
Using front matter.
---
inline_js:
- console.log("foo bar");
- {type: 'application/json', id: 'some-other-id', js: '{"data": 123}'}
---
{% metagen
inline_js=inline_js
%}
=>
<script>console.log("foo bar");</script>
<script type="application/json" id="some-other-id">{"data": 123}</script>