# Meta Description nicht als Variable verfügbar?

**URL:** <https://forum.shopware.com/t/meta-description-nicht-als-variable-verfugbar/50101>\
**Category:** Themes & Design\
**Created:** [19. Dezember 2017 um 14:45 UTC](https://forum.shopware.com/t/meta-description-nicht-als-variable-verfugbar/50101 "2017-12-19T14:45:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![brettvormkopp](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/brettvormkopp/32/7788_2.png) [@brettvormkopp](https://forum.shopware.com/u/brettvormkopp)\
**Post date:** [19. Dezember 2017 um 14:45 UTC](https://forum.shopware.com/t/meta-description-nicht-als-variable-verfugbar/50101/1 "2017-12-19T14:45:34Z")

</div>

Hallo, ich habe eine Frage bezüglich der Meta-Description. In jeder Kategorie funktionieren die Meta-Information/Variablen, ausser $sCategoryContent.metadescription. Alle Angaben in der Meta-Information sind auch ausgefüllt. Es gibt kein Plugin welches den Header üebrschreibt.&nbsp;In den Einstellungen-\>Storefront-\>Seo-Routereinstellungen-\>“Meta-Description von Artikel/Kategorien aufbereiten”&nbsp; steht “ja”. Habe im frontend/index/header.tpl und frontend/listing/header.tpl versucht die Metaangaben auszulesen, aber es klappt nicht. Shopware 5.1.2.

So ist das Original des header.tpl:&nbsp;

```
 {$description = "{s name='IndexMetaDescriptionStandard'}{/s}"}
 {if $sCategoryContent.cmstext}
     {$description = "{$sCategoryContent.cmstext|strip_tags|truncate:240|escapeHtmlAttr}"}
 {elseif $sCategoryContent.metadescription}
     {$description = "{$sCategoryContent.metadescription|strip_tags|escapeHtmlAttr}"}
 {/if}

```

Wenn ich das reduziere auf:

```
{$description = "{$sCategoryContent.metadescription|strip_tags|escapeHtmlAttr}"}

```

und ausgebe als:

```
{$description}

```

bleibt der Inhalt leer (Frontend neu kompiliert).&nbsp;

- sCategoryContent.cmstext (funktioniert)
- sCategoryContent.metaTitle (funktioniert)
- sCategoryContent.title (funktioniert)
- sCategoryContent.metadescription (funktioniert nicht)

&nbsp;Weiss jemand einen Rat? Danke und Gruss

---

<div class="post-metadata">

**Author:** ![simkli](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/simkli/32/13124_2.png) [@simkli](https://forum.shopware.com/u/simkli)\
**Post date:** [19. Dezember 2017 um 15:12 UTC](https://forum.shopware.com/t/meta-description-nicht-als-variable-verfugbar/50101/2 "2017-12-19T15:12:47Z")

</div>

Wenn meta **T** itle funktionert, hast du dann mal meta **D** escription ausprobiert?

Viele Grüße

---

<div class="post-metadata">

**Author:** ![brettvormkopp](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/brettvormkopp/32/7788_2.png) [@brettvormkopp](https://forum.shopware.com/u/brettvormkopp)\
**Post date:** [19. Dezember 2017 um 18:41 UTC](https://forum.shopware.com/t/meta-description-nicht-als-variable-verfugbar/50101/3 "2017-12-19T18:41:58Z")

</div>

Mhh, ich habe etwas recherchriert. zwischen der 5.0 und 5.1 Shopware Version wurde aus metadescription ein metaDescription.

5.0:

```
{$description = "{s name='IndexMetaDescriptionStandard'}{/s}"}
{if $sCategoryContent.cmstext}
   {$description = "{$sCategoryContent.cmstext|strip_tags|truncate:240|escape:'htmlall'}"}
{elseif $sCategoryContent.metadescription}
   {$description = "{$sCategoryContent.metadescription|strip_tags|escape:'htmlall'}"}
{/if}

```

5.1:

```
{$description = "{s name='IndexMetaDescriptionStandard'}{/s}"}
{if $sCategoryContent.cmstext}
    {$description = "{$sCategoryContent.cmstext|strip_tags|truncate:240|escapeHtml}"}
{elseif $sCategoryContent.metaDescription}
     {$description = "{$sCategoryContent.metaDescription|strip_tags|escapeHtml}"}
{/if}

```

5.1.2: **(meine komische Version)**

```
{$description = "{s name='IndexMetaDescriptionStandard'}{/s}"}
{if $sCategoryContent.cmstext}
  {$description = "{$sCategoryContent.cmstext|strip_tags|truncate:240|escapeHtmlAttr}"}
{elseif $sCategoryContent.metadescription}
  {$description = "{$sCategoryContent.metadescription|strip_tags|escapeHtmlAttr}"}
{/if}

```

5.3.4:

```
{$description = "{s name='IndexMetaDescriptionStandard'}{/s}"}
{if $sCategoryContent.cmstext}
   {$description = "{$sCategoryContent.cmstext|strip_tags|truncate:240|escapeHtml}"}
{elseif $sCategoryContent.metaDescription}
   {$description = "{$sCategoryContent.metaDescription|strip_tags|escapeHtml}"}
{/if}

```

&nbsp;

Chaos perfekt 🙂

---

<div class="post-metadata">

**Author:** ![brettvormkopp](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/brettvormkopp/32/7788_2.png) [@brettvormkopp](https://forum.shopware.com/u/brettvormkopp)\
**Post date:** [19. Dezember 2017 um 20:45 UTC](https://forum.shopware.com/t/meta-description-nicht-als-variable-verfugbar/50101/4 "2017-12-19T20:45:38Z")

</div>

Lösung war jetzt, nur diese einzige Variablendefinition zu machen und die Textbaustein/if/else in den Wind zu schiessen:

```
{$description = "{$sCategoryContent.metaDescription|strip_tags|escapeHtmlAttr}"}

```

&nbsp;

---

<div class="post-metadata">

**Author:** ![malzfons](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@malzfons](https://forum.shopware.com/u/malzfons)\
**Post date:** [19. Dezember 2017 um 22:53 UTC](https://forum.shopware.com/t/meta-description-nicht-als-variable-verfugbar/50101/5 "2017-12-19T22:53:56Z")

</div>

Kann man denn auch für die Frontend Sitemap so eine Meta Description und Meta Keywords ausgeben?

&nbsp;

---

<div class="post-metadata">

**Author:** ![Moritz\_Naczenski](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/moritz_naczenski/32/7792_2.png) [@Moritz\_Naczenski](https://forum.shopware.com/u/Moritz_Naczenski)\
**Post date:** [20. Dezember 2017 um 07:57 UTC](https://forum.shopware.com/t/meta-description-nicht-als-variable-verfugbar/50101/6 "2017-12-20T07:57:22Z")

</div>

> [@malzfons schrieb:](https://forum.shopware.com/profile/22034/malzfons "malzfons")
> 
> Kann man denn auch für die Frontend Sitemap so eine Meta Description und Meta Keywords ausgeben?
> 
> &nbsp;

Ja, du kannst ja die index/header.tpl mit einer Abfrage anpassen und dann andere Meta-Tags setzen, wenn es die Sitemap ist. Bspw. so:

```
{extends file="parent:frontend/index/header.tpl"}

{block name="frontend_index_header_meta_description"}
{if $Controller == "sitemap"}
{s name='SitemapMetaDescriptionStandard'}{/s}
{else}
{$smarty.block.parent}
{/if}
{/block}

```

Hab da im Beispiel einfach einen anderen Textbaustein angelegt.
