Skip to content

Commit

Permalink
Fix template exception in SEO preview. Bump to 2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mmikkel committed Feb 27, 2023
1 parent 7e17178 commit d5f4352
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# SEOMate Changelog

## 2.1.1 - 2023-02-27
### Fixed
- Fixes a template exception that could be thrown when rendering SEO previews

## 2.1.0 - 2023-02-15
### Added
- Custom meta templates and template overrides are now supported in SEO previews (#28)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vaersaagod/seomate",
"description": "SEO, mate! It's important.",
"type": "craft-plugin",
"version": "2.1.0",
"version": "2.1.1",
"keywords": [
"craft",
"cms",
Expand Down
16 changes: 13 additions & 3 deletions src/templates/_previews/google/default.twig
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
{% set title = meta.title|default %}
{% set url = meta.url|default %}
{% set description = meta.description|default %}

<div class="Google__default">
<div class="Google__title">
{{ meta.title|striptags|raw }}
{% if title %}
{{ title|striptags|raw }}
{% endif %}
</div>
<div class="Google__url">
{{ entry.url | length > 85 ? entry.url[:85] ~ '...' : entry.url }}
{% if url %}
{{ url | length > 85 ? url[:85] ~ '...' : url }}
{% endif %}
</div>

<div class="Google__description">
{{ (meta.description | length > 150 ? meta.description[:150] ~ '...' : meta.description)|striptags|raw }}
{% if description %}
{{ (description | length > 150 ? description[:150] ~ '...' : description)|striptags|raw }}
{% endif %}
</div>
</div>

0 comments on commit d5f4352

Please sign in to comment.