Page 1 of 1

set "noindex" for URLs containing "mact"

Posted: Tue Feb 21, 2023 3:01 pm
by creopard
Dear community,

having installed the News and CGBlog Module, I have plenty of URLs like:

Code: Select all

.../index.php?mact=CGBlog,me9d1a,default,1&me9d1apagelimit=10&me9d1apagenumber=6&me9d1areturnid=1&page=1
Since Google Webmastertools keeps complaining about "sites with same content", I decided to set a "noindex" for these kind of pages with an UDT:

Code: Select all

//UDT CODE for "noindex_on_mact_urls"
if (substr($_SERVER['QUERY_STRING'], 0, 5 ) === "mact="){
$noindexurl = 'true';
$smarty->assign('noindexurl', $noindexurl);
}
I'm calling this UDT {noindex_on_mact_urls} in the header section before the {metadata} tag.
In the global settings -> global metadata, I've inserted this snippet:

Code: Select all

{if ((isset($noindexurl) && $noindexurl =='true'))}
{*via UDT "noindex_on_mact_urls"*}
<meta name="robots" content="noindex, follow">
{else}
<meta name="robots" content="index, follow">
{/if}
So all URLs starting with "mact=" won't be indexed by Google any more :)

This approach works quite well, but is there a more elegant way to do this?

Re: set "noindex" for URLs containing "mact"

Posted: Tue Feb 21, 2023 4:13 pm
by DIGI3
You can omit url parameters directly within Google's console.

Re: set "noindex" for URLs containing "mact"

Posted: Tue Feb 21, 2023 4:44 pm
by creopard
Good point, but I guess that will only help before Google is aware of the URLs.
I've read elsewhere:
“The URL parameter handling tool would not remove URLs from the search results. It’s really only to refine the crawling of URLs.

So it’s not something where we would say you add this parameter to that tool and then suddenly all those pages disappear from search results.

It’s more that, over time, we would crawl those URLs less and over time they would drop out from the search results but it wouldn’t be any immediate change there.”
Starting at 46:44
https://www.youtube.com/watch?v=5w4iFGxrqjY