thread_view
:<xf:comment>Do not index anything other than Page 1</xf:comment>
<xf:if is = "$page != 1">
<xf:head option="metaNoindex"><meta name="robots" content="noindex" /></xf:head>
</xf:if>
<xf:comment>
line is not necessary, but I use it around custom XF template syntax so that I can search a template to find, modify, or remove it easily. Without it, it could get lost if you ever decide to index more than just the 1st page.If you want to not index anything other than Page 1, put this as the very last lines of the templatethread_view
:
HTML:<xf:comment>Do not index anything other than Page 1</xf:comment> <xf:if is = "$page != 1"> <xf:head option="metaNoindex"><meta name="robots" content="noindex" /></xf:head> </xf:if>
The<xf:comment>
line is not necessary, but I use it around custom XF template syntax so that I can search a template to find, modify, or remove it easily. Without it, it could get lost if you ever decide to index more than just the 1st page.
There are other variables and if statements that can be used to judge about where you'd want it to cut off, but it gets a little more complicated than that.
Let me know if this isn't suitable for your needs and I'll try to tinker with it more in the morning.
Correct, you'd just need to wrap it in anotherThis would noindex all thread pages on all (sub)forums.
<xf:if>
statement to apply to the nodes that you want.Find and re/move this to the bottom ofGoogle also suggest removing the canonical metatag when noindexing a page.
thread_view
if that's the case:<xf:macro id="metadata_macros::metadata"
arg-description="{$fpSnippet}"
arg-shareUrl="{{ link('canonical:threads', $thread) }}"
arg-canonicalUrl="{{ link('canonical:threads', $thread, {'page': $page}) }}" />
<xf:comment>Do not index anything other than Page 1</xf:comment>
<xf:if is = "$page != 1">
<xf:head option="metaNoindex"><meta name="robots" content="noindex" /></xf:head>
</xf:if>
<xf:if is = "$page == 1">
<xf:macro id="metadata_macros::metadata"
arg-description="{$fpSnippet}"
arg-shareUrl="{{ link('canonical:threads', $thread) }}"
arg-canonicalUrl="{{ link('canonical:threads', $thread, {'page': $page}) }}" />
</xf:if>
Correct, you'd just need to wrap it in another<xf:if>
statement to apply to the nodes that you want.
<xf:if is="in_array($thread.thread_id, [1,2,3])">
Per thread_id would be better option instead of full node.
<xf:comment>Do not index anything other than Page 1 of thread id 1</xf:comment>
<xf:if is = "$page != 1">
<xf:head option="metaNoindex"><meta name="robots" content="noindex" /></xf:head>
</xf:if>
<xf:if is = "in_array($thread.thread_id, [1])">
<xf:if is = "$page == 1">
<xf:macro id="metadata_macros::metadata"
arg-description="{$fpSnippet}"
arg-shareUrl="{{ link('canonical:threads', $thread) }}"
arg-canonicalUrl="{{ link('canonical:threads', $thread, {'page': $page}) }}" />
</xf:if>
</xf:if>
<xf:if is = "!in_array($thread.thread_id, [1])">
<xf:if is = "in_array($thread.thread_id, [1, 2])">
[/ICODE]
[CODE=html]
<xf:if is = "in_array($thread.thread_id, [1, 2, 3])">
[/ICODE]
[CODE=html]
<xf:if is = "in_array($thread.thread_id, [1, 2, 3, 4])">
$thread.thread_id
, not $forum.thread_id
<xf:if is="in_array($thread.thread_id, [1,2,3])">
!
before in_array
and $thread.thread_id
in the thread_view template (post.thread_id in some others)RIght. It's 1 AM here and you replied so quickly, that I jumped to the quickest solutions without double-checking other threads to ensure accuracy and also making, now, 2 errors, before posting. Updated as such.Should be without!
beforein_array
thread_view
no problem.Freshness isn't always relevant. The first page could have the substance while the last page could be filled with GIFs. Which would have more weight then?As Google appreciates content freshness, why not only have the last page indexed?
After inspectingThere are other variables and if statements that can be used to judge about where you'd want it to cut off, but it gets a little more complicated than that.
$thread
and knowing how many posts per page you have, the conditional isn't as hard as I would imagine (as I was going to try to do regex on the URI).$thread.reply_count
is say less than or equal to 60 for the first 3 pages if you have it set to the default of 20 posts per page.RIght. It's 1 AM here and you replied so quickly, that I jumped to the quickest solutions without double-checking other threads to ensure accuracy and also making, now, 2 errors, before posting. Updated as such.
Hope this helps you out until it's implemented.
It might be better to make this an add on that you can easily type in the thread_ids as it's an easy template edit once it knows the values.
I'm sure @AndyB could work off that template edit to put it in an add on that adds that code to the end ofthread_view
no problem.
Otherwise, you're going to have pages upon pages of edit history as you add threads to the array.
$page > '1'
to other number for more pages indexed and $thread.thread_id, [1,2,3,4,5]
for which threads.<xf:comment>Do not index anything other than Page 1 of thread id </xf:comment>
<xf:if is="$page > '1' AND in_array($thread.thread_id, [1,2,3,4,5])">
<xf:head option="metaNoindex"><meta name="robots" content="noindex" /></xf:head>
</xf:if>
<xf:comment>Do not index anything other than Page 1 of thread id and show canonical only on indexed pages</xf:comment>
<xf:if is="$page > '1' AND in_array($thread.thread_id, [1,2,3,4,5])">
<xf:head option="metaNoindex"><meta name="robots" content="noindex" /></xf:head>
<xf:else/>
<xf:macro template="metadata_macros" name="metadata"
arg-canonicalUrl="{{ link('canonical:threads', $thread, {'page': $page}) }}" />
</xf:if>
arg-canonicalUrl="{{ link('canonical:threads', $thread, {'page': $page}) }}"
from thread_view template<xf:macro template="metadata_macros" name="metadata"
arg-description="{$fpSnippet}"
arg-shareUrl="{{ link('canonical:threads', $thread) }}"
arg-canonicalUrl="{{ link('canonical:threads', $thread, {'page': $page}) }}" />
We use essential cookies to make this site work, and optional cookies to enhance your experience.