aerni / statamic-advanced-seo

Comprehensive SEO addon for Statamic with flexibility in mind
https://statamic.com/addons/aerni/advanced-seo
11 stars 6 forks source link

Add support for variables #52

Closed aerni closed 1 year ago

aerni commented 1 year ago

This PR adds support for variables in any text, textarea, and code field.

Basic Usage

Support for variables comes in two flavors.

Antlers Our beloved Antlers. Use it like you're used to:

seo_title: '{{ title }}'

@field Unlike Antlers, this syntax also works with GraphQL:

seo_title: '@field:title'

Advanced Usage

You can also get values from linked entries:

# Antlers
seo_title: '{{ event:title }}'

# @field
seo_title: '@field:event:title'

If you want to go totally nuts, this works too:

# in an entry
seo_title: '@default'

# in the collection defaults
seo_title: '@field:title'