Implementing Cannonical & Alternate tags on a large website
-
Hi There,
Our brochureware website consists of a Desktop site (www.oursite.com)and a Mobile website (m.oursite.com).
I know I need to implement the alternate tags on the desktop pages and the cannonical tags on the mobile versions. However we have a huge site is there any dynamic way through javascript to have the code be generated or is it something that should be done manually page by page?
Below is sample javascript a colleague completed to attempt to dynamically develop the snippet but I am unsure if bots will be able to interpret it:
Alternate version:
Thanks in advance
Phil
-
JavaScript is client-side code that's generally rendered in browsers, which means Google crawlers typically won't see it, and the almost definitely won't process it for these kinds of directives.
You can create these tags dynamically, but you need to do it with a server-side scripting language, like PHP, ASP, etc. That's a common practice, and many large sites dynamically code canonical tags, META ROBOTS, etc. (I've done it on many sites).
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Tags problem I need help
Hello I have a problem on my site and I want to help solve it I allow adding tags in search engines However, when writing new content, tags are not added to search engines This is my website link مجلة الحلوة
Technical SEO | | ahmedahmed3230 -
Should we reinstate the old website?
In a nut shell we had a great site that performed well and grew month on month but it perhaps looked a bit dated. A decision was taken to build a new site and the job given to a PR agency for some reason. All the titles, H1 tags, page content and url structure was changed and now the site has drop 50% of organic traffic. I've been tasked with trying to rebuild rankings but so far it's not going well. A snapshot of the old website still exists and i'm very tempted to have it reinstated in the hopes that our traffic will recover. What are your thoughts?
Technical SEO | | etienneb0 -
Tags, Categories, & Duplicate Content
Looking for some advice on a duplicate content issue that we're having that definitely isn't unique to us. See, we are allowing all our tag and category pages, as well as our blog pagination be indexed and followed, but Moz is detecting that all as duplicate content, which is obvious since it is the same content that is on our blog posts. We've decided in the past to keep these pages the way they are as it hasn't seemed to hurt us specifically and we hoped it would help our overall ranking. We haven't seen positive or negative signals either way, just the warnings from Moz. We are wondering if we should noindex these pages and if that could cause a positive change, but we're worried it might cause a big negative change as well. Have you confronted this issue? What did you decide and what were the results? Thanks in advance!
Technical SEO | | bradhodson0 -
HTTP & HTTPS
what is best recommended when some of the pages on site goes from HTTP to HTTPS: 301 redirection or 302 redirection?
Technical SEO | | JonsonSwartz
and why? thank you I was asked to elaborate so: on my website I have open account pages. users are asked to fill the details. those page are secured and are HTTPS. the problem is that the whole website turned to HTTPS so they redirected most of the pages from HTTPS to HTTP.
the secured pages are redirected from HTTP to HTTPS. I wanted to check if it's correct and what is the best redirection way (301 or 302)0 -
My beta site (beta.website.com) has been inadvertently indexed. Its cached pages are taking traffic away from our real website (website.com). Should I just "NO INDEX" the entire beta site and if so, what's the best way to do this? Please advise.
My beta site (beta.website.com) has been inadvertently indexed. Its cached pages are taking traffic away from our real website (website.com). Should I just "NO INDEX" the entire beta site and if so, what's the best way to do this? Are there any other precautions I should be taking? Please advise.
Technical SEO | | BVREID0 -
Should I include tags in sitemap?
Hello All, I was wondering if you should include tags and categories in your sitemap. In the past on previous blogs I have always left tags and categories out. The reason for this is a good friend of mine who has been doing SEO for a long time and inhouse always told me that this would result in duplicate content. I thought that it would be a great idea to get some input from the SEOmoz community as this obviously has a big affect on your blog and the number of pages indexed. Any help would be great. Thanks, Luke Hutchinson.
Technical SEO | | LukeHutchinson1 -
What if meta description tag comes before meta title tag? Do the search engines disregard or penalize if the order is not title then description in the HTML?
Do the search engines disregard or penalize if the order is not title then description in the HTML? A client's webmaster is a newbie to SEO and did just this. Suggestions?
Technical SEO | | alankoen1230 -
Title tag keyword prioritizing
It's widely accepted that in title tags, the first word ranks the highest, and each word after that contributes less than the one before. So a page with the title "Philadelphia Parks" will rank higher than "Parks in Philadelphia" for Philadelphia, but the second page will rank higher for Parks. With this in mind, which keywords should I put first in the title tags of my product pages? Brand name? Product SKU? Is it better to prioritze general words with higher search volume (more impressions) or more specific terms with lower search volume (stronger long tail)? Any guidance would be appreciated. Thanks
Technical SEO | | AmericanOutlets0