In website operation, Search Engine Optimization (SEO) is one of the core tasks to enhance website visibility.The setting and correct display of the canonical URL (Canonical URL) is crucial for avoiding content duplication, optimizing crawling efficiency, and concentrating page weight.AnQiCMS (AnQiCMS) is a highly SEO-focused enterprise-level content management system that provides users with convenient tools for managing and deploying standard links.
What is a canonical URL (Canonical URL)?
The norm link, as the name implies, is to inform the search engine of the 'normative' or 'preferred' version of a web page.In the operation of a website, for various reasons, the same content may be accessed through different URL addresses.
http://www.yourdomain.com/pageandhttps://www.yourdomain.com/pageyourdomain.com/pageandwww.yourdomain.com/pageyourdomain.com/page?id=1andyourdomain.com/page?source=ad
These URLs may be different, but they point to content that is completely the same or highly similar.If not handled, search engines will treat it as duplicate content, which may lead to reduced crawling efficiency, affected page rankings, and even diluted link weight obtained from different URL versions.The purpose of the specification link is to clearly inform search engines which URL is the main content or the 'official' version, thereby concentrating all signals to the preferred URL.
The importance of canonical URL for SEO
Using canonical URL correctly can bring multiple SEO benefits to a website:
- Avoid duplicate content issues:This is the most important function.Standard links can effectively resolve the problem of duplicate content caused by URL parameters, session ID, HTTP/HTTPS version, and WWW/non-WWW version.
- Concentrate link weight:When multiple URLs point to the same content, the weight of all external links (external links) pointing to these URLs will be dispersed.By linking to the standard, these scattered weights can be unified and concentrated to the preferred standard URL, thereby enhancing the overall weight of the page.
- Improve crawling efficiency:The crawl budget of search engines is limited.By specifying clear guidelines, search engines can avoid repeated crawling and indexing of the same content under different URLs, using valuable crawling resources to discover new content or more important content on websites, and improving the overall crawling efficiency of the website.
- Improve search results display:Search engines tend to display standard URLs in search results, which helps improve user experience and avoids users clicking on non-preferred duplicate pages.
Set the specification link in the AnQiCMS background
The specific operation path is: go to the background“Content Management”, select“Document Management”or“Page Management”, click the document or page you want to edit. In the editing interface,“Other Parameters”section, you will find a name called“Standard Link”Input box.
Here, you need to fill in acomplete URL addressi.e., withhttporhttpsa full path link starting with, for examplehttps://www.yourdomain.com/article/your-preferred-page.Make sure the link is correct, an incorrect standard link may cause unexpected SEO problems.If your page does not have a specific specification link to point to, it is usually okay to keep it empty, AnQiCMS will automatically handle self-referencing specification links.
Display the specification link in the AnQiCMS template
After setting the specification link in the background, the next most critical step is to output this correctly on the front-end page of the website<link rel="canonical">Tags. AnQiCMS provides powerful template tags that can easily achieve this.
To display the specification link of the current page, you can use the built-in AnQiCMStdk(Title, Description, Keywords) tag, it also supports obtaining the standard link information of the page. Usually, this tag is placed in the website template file (such asbase.htmlOr detail page template) of<head>Within the area.
The following is the recommended code snippet for displaying specification links in the AnQiCMS template:
{%- tdk canonical with name="CanonicalUrl" %}
{%- if canonical %}
<link rel="canonical" href="{{canonical}}" />
{%- endif %}
Let's parse this code step by step:
{%- tdk canonical with name="CanonicalUrl" %}:tdkIt is a tag used by AnQiCMS to obtain page TDK information.canonicalIt is a variable name you custom for the standard link data you obtain, you can name it according to your habits.with name="CanonicalUrl"We specified thattdkThe data type obtained from the tag is “CanonicalUrl”.- Before the tag
{%-And after the tag%}of-The symbol is used to remove the extra whitespace generated by the tag line, making the output HTML code cleaner.
{%- if canonical %}:- This is a conditional statement. It checks the custom-defined
canonicalThe variable exists and has a value. - This judgment is very important because not all pages need to manually set the specification link in the background. If
canonicalThe variable is empty, then nothing will be output.<link rel="canonical">The tag avoids outputting empty links or unnecessary code. Similarly,{%-Used to remove whitespace.
- This is a conditional statement. It checks the custom-defined
<link rel="canonical" href="{{canonical}}" />:- If
canonicalIf the variable has a value, this line of HTML code will be output to the page's<head>area. rel="canonical"It is a standard HTML attribute, telling the search engine that this is a valid link.href="{{canonical}}"Insert the valid link value we obtained from the backend intohrefthe attribute.
- If
Add the above code to your website template's<head>part (usuallybase.htmlFile, so that all pages can inherit), it can ensure that each page can output the standard link according to the background settings.
**Practical Tips and Warnings
- Unified across the entire site:Ensure that your standard link always uses the preferred domain of the website (for example, with
wwwor withoutwww) and a unified protocol (HTTPorHTTPS). For example, if you decide to usehttps://www.yourdomain.comAs a preference, all specification links should appear in this format. - Self-referential specification links:Even if the page does not have duplicate content, it is strongly recommended to set a link pointing to itself.AnQiCMS will usually intelligently use the URL of the current page as the self-reference specification link when you do not manually fill in the specification link.
- Use with caution:The specification link is not万能, should not be滥用.For pages that have been paginated, sorted, or filtered, it should be judged according to the actual situation whether it is necessary to set a standard link.Sometimes, these pages themselves are of unique value and should not be standardized to the main page.
- Avoid chained and incorrect links:Avoid linking the specification link to a page that has already set a specification link (i.e., do not have A specification to B, B specification to C), or to a 404 error page.This will confuse the search engine.
- Dynamic page handling:For dynamic list pages with filtering and sorting parameters, the usual practice is to make them point to themselves (self-referencing) or to a 'clean' version of the URL without any parameters, depending on whether these parameters will significantly change the content of the page.
Through AnQiCMS's convenient settings and powerful template features, you can easily implement standardized link deployment, effectively manage the SEO of your website, and make your website content perform better in search engines.
Frequently Asked Questions (FAQ)
Q1: I have set up the specification link in the background, why doesn't it show up on the website front end?A1: First, please confirm whether you have added the above provided template code correctly to your website template file.<head>Area. Next, check if you have filled in the information for this page in the AnQiCMS backgroundCompleteStandard link (for examplehttps://www.yourdomain.com/pageIf only the relative path or an incomplete link is filled in, the system may not be able to identify and output it. Finally, clear the AnQiCMS system cache and check the browser cache.
Q2: Should I set a canonical link for all pages?A2: It is recommended to set a self-referencing standard link for each important page.This helps to avoid potential duplicate content issues and clearly informs search engines of the preferred URL for this page.In cases where there are multiple URLs pointing to the same content, it is essential to make standardized settings.For some pages without actual SEO value (such as user session ID), it can be standardized to a version without parameters.
Q3: What is the difference between Canonical URL and 301 redirect? Which one should I choose?A3: They are all ways to handle duplicate URLs, but their mechanisms are different.
- Canonical URLIs to make a suggestion to the search engine, telling it which page is the preferred version, but the search engine will still crawl all versions.When a user accesses a duplicate URL, they will stay on that URL page.
- 301 RedirectIs a permanent server-side command, directly to