Skip to content

Commit

Permalink
Merge pull request #66 from dgsiegel/void-meta-tags
Browse files Browse the repository at this point in the history
Void meta tags don't require a closing slash anymore
  • Loading branch information
mmikkel committed Jan 19, 2024
2 parents a324381 + d4dd091 commit 109bd2d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/models/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class Settings extends Model
];

public array $tagTemplateMap = [
'default' => '<meta name="{{ key }}" content="{{ value }}"/>',
'default' => '<meta name="{{ key }}" content="{{ value }}">',
'title' => '<title>{{ value }}</title>',
'/^og:/,/^fb:/' => '<meta property="{{ key }}" content="{{ value }}">',
];
Expand Down
10 changes: 5 additions & 5 deletions src/templates/_output/meta.twig
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{% set meta = seomate.meta %}
<link rel="home" href="{{ siteUrl() }}"/>
<link rel="home" href="{{ siteUrl() }}">
{% if craft.app.getResponse().getStatusCode() < 400 %}
<link rel="canonical" href="{{ seomate.canonicalUrl }}">
{% if meta['og:url'] is not defined %}<meta property="og:url" content="{{ seomate.canonicalUrl }}"/>{% endif %}
{% if meta['twitter:url'] is not defined %}<meta name="twitter:url" content="{{ seomate.canonicalUrl }}"/>{% endif %}
{% if meta['og:locale'] is not defined %}<meta property="og:locale" content="{{ craft.app.getSites().getCurrentSite().language }}"/>{% endif %}
{% if meta['og:url'] is not defined %}<meta property="og:url" content="{{ seomate.canonicalUrl }}">{% endif %}
{% if meta['twitter:url'] is not defined %}<meta name="twitter:url" content="{{ seomate.canonicalUrl }}">{% endif %}
{% if meta['og:locale'] is not defined %}<meta property="og:locale" content="{{ craft.app.getSites().getCurrentSite().language }}">{% endif %}
{% endif %}

{% for key, data in meta %}
Expand All @@ -16,6 +16,6 @@
{% set alternateUrls = seomate.alternateUrls ?? null %}
{% if alternateUrls %}
{% for alternateUrl in alternateUrls -%}
<link rel="alternate" href="{{ alternateUrl.url }}" hreflang="{{ alternateUrl.language }}"/>
<link rel="alternate" href="{{ alternateUrl.url }}" hreflang="{{ alternateUrl.language }}">
{% endfor %}
{% endif %}

0 comments on commit 109bd2d

Please sign in to comment.