问题原文
原帖链接 · Tonald Drump · CC BY-SA 4.0
I have a homepage, https://example.com, where a parameter can be added to unlock a discount on our website https://example.com?code=abc. I don't want this URL to be appear in Google search results, which it currently does.
According to the following doc, I should add a noindex meta tag: https://support.google.com/webmasters/answer/9689846#make_permanent
I am wondering though if I really should add a noindex meta tag to my homepage when the code parameter is present. I obviously don't want to hurt my home pages' SEO. Specifically, I have some link juice for https://example.com?code=abc and would like that to benefit https://example.com.
Question 1: is this really safe?
Question 2: would a canonical tag serve the same purpose? So that https://example.com?code=abc declares https://example.com as canonical. To make things more complicated, the homepage is actually localized as https://example.com/de?code=abc and https://example.com/en?code=abc.
已采纳解答
原帖链接 · Maximillian Laumeister · CC BY-SA 4.0
You definitely want to use a canonical tag here, not noindex.
For URLs of the form https://example.com/de?code=abc, use a canonical tag pointing to https://example.com/de.
For URLs of the form https://example.com/en?code=abc, use a canonical tag pointing to https://example.com/en.
The noindex directive tells the crawler that it should not index the page. The canonical tag tells the crawler that it should index the page but at a different URL, which fits your intent much more closely.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
