-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom template throwing errors #81
Comments
Hey @freder, could you shared the full template you are using? Thanks! |
{# SEO Fields meta fields start #}
{% set seoFields = getSeoFields() %}
{% set meta = seoFields.meta %}
{% if meta %}
{# <title>{{ meta.getPageTitle(element) }}</title> #}
<meta name="description" content="{{ meta.getMetaDescription() }}">
{# Facebook #}
<meta property="og:url" content="{{ craft.app.request.absoluteUrl }}"/>
<meta property="og:type" content="website"/>
<meta property="og:title" content="{{ meta.getOgTitle(element) }}"/>
{% set ogImage = meta.getOgImage() %}
{% if ogImage %}
<meta property="og:image" content="{{ ogImage.url }}"/>
<meta property="og:image:width" content="{{ ogImage.width }}"/>
<meta property="og:image:height" content="{{ ogImage.height }}"/>
<meta property="og:image:alt" content="{{ ogImage.alt }}"/>
{% endif %}
<meta property="og:description" content="{{ meta.getOgDescription() }}"/>
<meta property="og:site_name" content=""/>
<meta property="og:locale" content="{{ currentSite.language }}"/>
{# Twitter #}
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="" />
<meta name="twitter:url" content="{{ craft.app.request.absoluteUrl }}" />
<meta name="twitter:title" content="{{ meta.getTwitterTitle(element) }}" />
<meta name="twitter:description" content="{{ meta.getTwitterDescription() }}" />
{% if ogImage %}
<meta name="twitter:image" content="{{ meta.getTwitterImage().url ?? ogImage.url }}" />
{% endif %}
{% if craft.app.response.statusCode < 400 %}
<link rel="canonical" href="{{ meta.getCanonical() }}" />
{% endif %}
{% for alt in meta.getAlternate(element) %}
<link rel="alternate" hreflang="{{ alt.language }}" href="{{ alt.url }}" />
{% endfor %}
{% endif %}
{# SEO Fields meta fields end #} |
I don't think it is just custom templates. I get the same error when pasting the custom meta commands into a normal entry template:
yields
entire code:
|
@janhenckens could you please look into this? |
@freder I'm working on a fix for this, while also trying to fix the errors @chadcrowell reported above. I'll split them in separate releases and move the others to a new issue as they are not related. Update should be out in a couple of hours. |
@freder can you update to 3.3.3 and see if that fixes the error? You'll also want to update your template to match this one https://github.com/studioespresso/craft-seo-fields/blob/develop/src/templates/_meta.twig |
seems to work now. thanks |
Replacing
{% hook 'seo-fields' %}
with{% include 'seo.twig' %}
(copied https://github.com/studioespresso/craft-seo-fields/blob/master/src/templates/_meta.twig) throws errors:I assume I'm not doing it right... but I might need a hint as to what's going wrong here.
Maybe add some more details in the documentation?
The text was updated successfully, but these errors were encountered: