<p>In my <code>_layout.html</code>, I render the SEOmatic stuff via </p>

<p><code>{% hook 'seomaticRender' %}</code></p>

<p>This works fine for basically all content singles/channels, etc. </p>

<p>Now I have one template <code>/newsletters/index.twig</code> which works both as an archive page and a typical <code>_entry</code> page, in one. </p>

<p>If there's a 3rd segment or rather slug, it lists the archive sidebar and displays an entries content. So <code>read/newsletter/sunny-beach</code> works fine, and SEOmatic renders everything excellent. </p>

<p>However, when there's not a 3rd segment, so it's just <code>read/newsletter</code>, it works as an archive page, and the seoTitle should become "Newsletter archive". </p>

<p>From what I find is that <code>{% do seomatic.meta.seoTitle("Newsletter archive") %}</code> should enable me to push that through. But it doesn't, something like: </p>

<pre><code>{% extends "_layout" %}

{% block main %}
    {% if craft.app.request.getSegment(3) == "" %}
         {% set entry = craft.entries.section('newsletters').orderby('newsletterIssueNumber desc').one() %}
         {# yes so  if there's no last segment, we're going to load the newest entry, which it does succesfully #}
         {% do seomatic.meta.seoTitle("Newsletter archive") %}
    {% endif %}
    ...
{% endblock %}
</code></pre>

<p>But it doesn't, do anything. No title. I also tried it with just putting it outside the <code>if</code>, so it gets executed for sure but, still nothing.</p>

<p>What makes it extra confusing is that in the SEOmatic docs they refer to a "New Template Meta" button, <a href="https://github.com/nystudio107/seomatic/wiki/04.-SEO-Template-Meta" rel="nofollow noreferrer">SEO Template Meta</a>, which I can't seem to find, and suppose it's a leftover from its Craft 2 version or something. </p>

<p>In short: how do I bubble up variables to the hook that is in _layout, from within a template? And there are no entries/slug for SEOmatic to base itself on.</p>

CC BY-SA 4.0
2019-04-13T22:22:50.403Z
So I'm really confused... are you using Craft 3.x or Craft 2.x here? `{% hook 'seomaticRender' %}` isn't a thing in the Craft 3 version of SEOmatic... but `{% do seomatic.meta.seoTitle("Newsletter archive") %}` is... also you're linking to the old Craft 2.x version of SEOmatic docs. The Craft 3 [SEOmatic docs are here](https://github.com/nystudio107/craft-seomatic/blob/v3/README.md).
andrew.welch
CC BY-SA 4.0
2019-04-17T17:48:11.120Z
Woah. I was using Craft3's version, but with googling for solutions the v2 documents came up all of the time, so went off road there. Now all seems clear.

I would be nice to have a better indication in the  v2 WIKI that it's about Craft 2. As any google search sends you to those. 

Thanks @and
tom
CC BY-SA 4.0
2019-04-18T03:23:49.453Z
Thanks, I added the deprecation notice that is on the github repo & README onto each page of the wiki docs!
andrew.welch
CC BY-SA 4.0
2019-04-19T23:34:53.553Z
Great, thanks that makes it much clearer, and maybe Google will take it into consideration as well. One quick question, as it goes hand in hand with our SEO, the CSV import for your Retour plugin, is that planned for any day soon on your roadmap? (I’m probably breaking a dozen of SE rules here).
tom
CC BY-SA 4.0
2019-04-23T13:17:11.310Z
Retour for Craft 3 already supports CSV importing -> https://github.com/nystudio107/craft-retour#importing-redirects-from-a-csv-file
andrew.welch
CC BY-SA 4.0
2019-04-24T11:29:17.600Z
Thanks @andrew.welch -- Again I was looking here: https://github.com/nystudio107/retour (end of page)
tom
CC BY-SA 4.0
2019-04-24T21:00:37.350Z
That's the old Craft 2.x Github Repo... it has DEPRECATED notices at the top, but probably the easiest way is to just always go here: [https://nystudio107.com/plugins](https://nystudio107.com/plugins)
andrew.welch
<plugin-seomatic><plugin-seo>
SEOmatic passing through variables
# SEOmatic passing through variables

(Asked by: username_0 on 2019-04-13)

In my _layout.html, I render the SEOmatic stuff via 
{% hook 'seomaticRender' %}
This works fine for basically all content singles/channels, etc. 
Now I have one template /newsletters/index.twig which works both as an archive page and a typical _entry page, in one. 
If there's a 3rd segment or rather slug, it lists the archive sidebar and displays an entries content. So read/newsletter/sunny-beach works fine, and SEOmatic renders everything excellent. 
However, when there's not a 3rd segment, so it's just read/newsletter, it works as an archive page, and the seoTitle should become "Newsletter archive". 
From what I find is that {% do seomatic.meta.seoTitle("Newsletter archive") %} should enable me to push that through. But it doesn't, something like: 
{% extends "_layout" %}

{% block main %}
    {% if craft.app.request.getSegment(3) == "" %}
         {% set entry = craft.entries.section('newsletters').orderby('newsletterIssueNumber desc').one() %}
         {# yes so  if there's no last segment, we're going to load the newest entry, which it does succesfully #}
         {% do seomatic.meta.seoTitle("Newsletter archive") %}
    {% endif %}
    ...
{% endblock %}

But it doesn't, do anything. No title. I also tried it with just putting it outside the if, so it gets executed for sure but, still nothing.
What makes it extra confusing is that in the SEOmatic docs they refer to a "New Template Meta" button, SEO Template Meta, which I can't seem to find, and suppose it's a leftover from its Craft 2 version or something. 
In short: how do I bubble up variables to the hook that is in _layout, from within a template? And there are no entries/slug for SEOmatic to base itself on.

**Tags:** plugin-seomatic, plugin-seo
> **Comments:**
> **username_1**: So I'm really confused... are you using Craft 3.x or Craft 2.x here? `{% hook 'seomaticRender' %}` isn't a thing in the Craft 3 version of SEOmatic... but `{% do seomatic.meta.seoTitle("Newsletter archive") %}` is... also you're linking to the old Craft 2.x version of SEOmatic docs. The Craft 3 [SEOmatic docs are here](https://github.com/nystudio107/craft-seomatic/blob/v3/README.md).  
> **username_0**: Woah. I was using Craft3's version, but with googling for solutions the v2 documents came up all of the time, so went off road there. Now all seems clear.  I would be nice to have a better indication in the  v2 WIKI that it's about Craft 2. As any google search sends you to those.   Thanks @and  
> **username_1**: Thanks, I added the deprecation notice that is on the github repo & README onto each page of the wiki docs!  
> **username_0**: Great, thanks that makes it much clearer, and maybe Google will take it into consideration as well. One quick question, as it goes hand in hand with our SEO, the CSV import for your Retour plugin, is that planned for any day soon on your roadmap? (I’m probably breaking a dozen of SE rules here).  
> **username_1**: Retour for Craft 3 already supports CSV importing -> https://github.com/nystudio107/craft-retour#importing-redirects-from-a-csv-file  
> **username_0**: Thanks @andrew.welch -- Again I was looking here: https://github.com/nystudio107/retour (end of page)  
> **username_1**: That's the old Craft 2.x Github Repo... it has DEPRECATED notices at the top, but probably the easiest way is to just always go here: [https://nystudio107.com/plugins](https://nystudio107.com/plugins)  

---

## 0 answers

