Answers.Body: <p>For any Elements that do not have URLs, like Tags or Users, you'll need to tell Sprout SEO what metadata to use.</p>
  
  <p>Also, be sure that the <code>do craft.sproutSeo.meta</code> tag comes before the <code>{% sproutseo 'optimize' %}</code> tag. The do tag prepares the metadata for the optimize tag to process:</p>
  
  <pre><code>{% do craft.sproutSeo.meta({ 
    section: 'Self Help Tips',
    title: tag.title,
    description: metadata.metaDescription|striptags|slice(0, 150),
    canonical: craft.request.url,
    ogTitle: tag.title,
    ogType: 'article',
    ogUrl: craft.request.url,
    ogImage: metaImage.url(),
    ogImageWidth: metaImage.width,
    ogImageHeight: metaImage.height,
    ogImageType: metaImage.mimeType,
    ogSiteName: siteName,
    ogDescription: metadata.description,
    twitterCard: 'summary',
    twitterSite: '@twitteruser',
    twitterCreator: '@twitteruser',
    twitterTitle: tag.title,
    twitterDescription: meta.search.description,
    twitterUrl: craft.request.url,
    twitterImage: metaImage.url()
  }) %}
  
  {% sproutseo 'optimize' %}
  </code></pre>
  
  <p>We do have on our list to simplify this scenario and allow you to add an Element Metadata field to the field layout and just pass the <code>elementId</code>.</p>
  
  <pre><code>{% do craft.sproutSeo.meta({ 
        elementId: 123
  }) %}
  
  {% sproutseo 'optimize' %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-30T23:04:16.030Z
Answers.LastActivityDate: 2018-04-30T23:04:16.030Z
Answers.UserDisplayName: Ben Parizek
Body: <p>ENVIRONMENT: Craft 2, Sprout SEO 3.4.2, Bob Olde Hampsink's "Tag Manager" plugin.</p>
  
  <p>The site has a bunch of articles organized by category and tags, and I've got a template for showing articles by tag (ex: <a href="https://www.therapyinphiladelphia.com/tips/tag/employment/" rel="nofollow noreferrer">https://www.therapyinphiladelphia.com/tips/tag/employment/</a>).</p>
  
  <p>In Sprout SEO I've "Enabled Meta Details fields" and attached them to Craft's TAGS using the Tag Manager plugin. This allows me to insert custom metadata for each TAG just like I would on a normal Craft entry.</p>
  
  <p>So in theory the <code>{% sproutseo 'optimize' %}</code> template tag on my "articles by tag" template should pick up the custom values entered into the Sprout SEO meta details fields for the tag... just like it would for a normal entry.</p>
  
  <p>However it's not picking up anything, it just reverts to the Globals set under Sprout SEO's settings.</p>
  
  <p>To debug I've done a couple of things:</p>
  
  <ol>
  <li><p>Under Sprout SEO > Settings > Advanced > Enabled custom metadata variable (giving it the name <code>metadata</code>), and</p></li>
  <li><p>turned on Craft's dev mode and echoed <code>{{ dump(metadata) }}</code> into the template.</p></li>
  </ol>
  
  <p>The output of <code>{{ dump(metadata) }}</code> shows the Globals set under Sprout SEO's settings and not the custom metadata entered into the Tag Manager for the selected tag.</p>
  
  <p>I've also tried using the <code>{% do craft.sproutSeo.meta() %}</code> function to manually override the automatic output of the <code>{% sproutseo 'optimize' %}</code> template tag.</p>
  
  <pre><code>{#
   # ARTICLES BY TAG TEMPLATE
   #}
  
  {% sproutseo 'optimize' %}
  
      {% do craft.sproutSeo.meta({ 
        section: 'Self Help Tips',
        title: tag.title,
        description: metadata.metaDescription|striptags|slice(0, 150),
        canonical: craft.request.url,
        ogTitle: tag.title,
        ogType: 'article',
        ogUrl: craft.request.url,
        ogImage: metaImage.url(),
        ogImageWidth: metaImage.width,
        ogImageHeight: metaImage.height,
        ogImageType: metaImage.mimeType,
        ogSiteName: siteName,
        ogDescription: metadata.description,
        twitterCard: 'summary',
        twitterSite: '@twitteruser',
        twitterCreator: '@twitteruser',
        twitterTitle: tag.title,
        twitterDescription: meta.search.description,
        twitterUrl: craft.request.url,
        twitterImage: metaImage.url()
      }) %}
  </code></pre>
  
  <p>This works if I enter hardcoded strings in, but the <code>metadata</code> variable in the template doesn't pick up the custom metadata entered for the tag.</p>
  
  <p>Is this a bug? Is the Sprout SEO plugin only set up to work with ENTRIES, and not TAGS?</p>
  
Tags: <plugin-sproutseo>
Title: Sprout SEO 3 with Craft Tags
ThreadText: # Sprout SEO 3 with Craft Tags
  
  (Asked by: username_0 on 2018-04-26)
  
  ENVIRONMENT: Craft 2, Sprout SEO 3.4.2, Bob Olde Hampsink's "Tag Manager" plugin.
  
  The site has a bunch of articles organized by category and tags, and I've got a template for showing articles by tag (ex: <https://www.therapyinphiladelphia.com/tips/tag/employment/>).
  
  In Sprout SEO I've "Enabled Meta Details fields" and attached them to Craft's TAGS using the Tag Manager plugin. This allows me to insert custom metadata for each TAG just like I would on a normal Craft entry.
  
  So in theory the `{% sproutseo 'optimize' %}` template tag on my "articles by tag" template should pick up the custom values entered into the Sprout SEO meta details fields for the tag... just like it would for a normal entry.
  
  However it's not picking up anything, it just reverts to the Globals set under Sprout SEO's settings.
  
  To debug I've done a couple of things:
  
  1. Under Sprout SEO > Settings > Advanced > Enabled custom metadata variable (giving it the name `metadata`), and
  2. turned on Craft's dev mode and echoed `{{ dump(metadata) }}` into the template.
  
  The output of `{{ dump(metadata) }}` shows the Globals set under Sprout SEO's settings and not the custom metadata entered into the Tag Manager for the selected tag.
  
  I've also tried using the `{% do craft.sproutSeo.meta() %}` function to manually override the automatic output of the `{% sproutseo 'optimize' %}` template tag.
  
  ```
  {#
   # ARTICLES BY TAG TEMPLATE
   #}
  
  {% sproutseo 'optimize' %}
  
      {% do craft.sproutSeo.meta({ 
        section: 'Self Help Tips',
        title: tag.title,
        description: metadata.metaDescription|striptags|slice(0, 150),
        canonical: craft.request.url,
        ogTitle: tag.title,
        ogType: 'article',
        ogUrl: craft.request.url,
        ogImage: metaImage.url(),
        ogImageWidth: metaImage.width,
        ogImageHeight: metaImage.height,
        ogImageType: metaImage.mimeType,
        ogSiteName: siteName,
        ogDescription: metadata.description,
        twitterCard: 'summary',
        twitterSite: '@twitteruser',
        twitterCreator: '@twitteruser',
        twitterTitle: tag.title,
        twitterDescription: meta.search.description,
        twitterUrl: craft.request.url,
        twitterImage: metaImage.url()
      }) %}
  
  ```
  
  This works if I enter hardcoded strings in, but the `metadata` variable in the template doesn't pick up the custom metadata entered for the tag.
  
  Is this a bug? Is the Sprout SEO plugin only set up to work with ENTRIES, and not TAGS?
  
  **Tags:** plugin-sproutseo
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-04-30. Score: 1
  
  For any Elements that do not have URLs, like Tags or Users, you'll need to tell Sprout SEO what metadata to use.
  
  Also, be sure that the `do craft.sproutSeo.meta` tag comes before the `{% sproutseo 'optimize' %}` tag. The do tag prepares the metadata for the optimize tag to process:
  
  ```
  {% do craft.sproutSeo.meta({ 
    section: 'Self Help Tips',
    title: tag.title,
    description: metadata.metaDescription|striptags|slice(0, 150),
    canonical: craft.request.url,
    ogTitle: tag.title,
    ogType: 'article',
    ogUrl: craft.request.url,
    ogImage: metaImage.url(),
    ogImageWidth: metaImage.width,
    ogImageHeight: metaImage.height,
    ogImageType: metaImage.mimeType,
    ogSiteName: siteName,
    ogDescription: metadata.description,
    twitterCard: 'summary',
    twitterSite: '@twitteruser',
    twitterCreator: '@twitteruser',
    twitterTitle: tag.title,
    twitterDescription: meta.search.description,
    twitterUrl: craft.request.url,
    twitterImage: metaImage.url()
  }) %}
  
  {% sproutseo 'optimize' %}
  
  ```
  
  We do have on our list to simplify this scenario and allow you to add an Element Metadata field to the field layout and just pass the `elementId`.
  
  ```
  {% do craft.sproutSeo.meta({ 
        elementId: 123
  }) %}
  
  {% sproutseo 'optimize' %}
  
  ```
  
  
  ---
  
  