Enable and disable Canonical URLs service
Sitefinity CMS’s canonical URLs implementation addresses the following issues:
- When you create various content items, for example news items, they can be published on many different pages on the site. Each page with a detail view of the content item is indexed by the search engine under separate URL, depending on the URL of the page.
- Your site can be accessed in different ways. For example, with or without www, with upper, lower or mixed casing, with difference in slashes or parameters. This also can result in multiple listings of the same content under separate URLs
Inserting Canonical URL meta tag handles these cases. This tag tells the search engine what is the page where the item opens by default. It can be inserted either in the <head>
tag of the page HTML or in the HTTP request. Sitefinity CMS adds the tag inside the <head>
tag of the page.
For example, <link rel="canonical" href="http://www.example.com/dresses/greendress.html">
For more information about canonical URLs, see About rel="canonical" and The Canonical Link Relation.
Configuring canonical URLs
To configure Sitefinity CMS to use canonical URLs, perform the following:
- In the main menu, click Administration » Settings » Advanced » System » Content Locations.
- Deselect Disable canonical URLs checkbox.
For new sites, the checkbox is deselected, by default. For upgraded sites, the checkbox is selected, by default.
- Click Save changes.
- Perform one of the following:
- If you use Sitefinity CMS to manage only one site, perform the following:
- In the main menu, click Administration » Settings » Advanced » System » Site URL Settings.
- Select Enable non-default Site URL Settings checkbox.
- Click Save changes.
- If you have multisite, for each site, perform the following:
- Select the site using the selector in the upper-left corner of the screen.
- Click Manage sites link.
- For each of the configured sites, click its Actions link and then Properties.
- Fill out the domain of the site and click Save changes.
- If items from one site are used on other sites via common provider, they will have canonical URL pointing to the item on the site where its default location is. For more information, see Multisite: Manage multiple sites.
Configuring canonical URLs for pages
In Sitefinity CMS, there are static and dynamic pages. The static pages are the pages in the Pages grid in Sitefinity CMS backend. The dynamic pages are static pages with some appendix in their URL that changes their output. For example, if a static page is http://mysite.com/home the dynamic page could be http://mysite.com/home/myNews and it will display the news item myNews in its detail mode.
You can turn on and off the canonical links for a static and for dynamic pages separately. You can enable and disable canonical URLs for static pages on site level and on page level. The page-level setting overrides the site-level setting. You control dynamic pages canonical URLs by setting canonical URLs on widget level.
Canonical URLs for static pages
- To turn on canonical links for all static pages, click Administration » Settings » Advanced » System » Content Locations » Page Default Canonical Url Settings and select Enable Pages default canonical url tag checkbox.
- To turn on canonical links for individual static page, perform the following:
- Open the Actions menu of Page and then choose Title & Properties.
- Expand Advanced options section.
- In Canonical Urls dropdown box, select whether you want to enable or disable canonical URLs for the page.
Query string parameters in canonical URLs
For static pages, you have an option to have query string parameters in the canonical URL. As the canonical URL is generated using the current request, by filtering the query string parameters, you can specify a list of the parameters that must always be preserved. You must add only parameters that lead to modification of the page content – for example, paging parameters. The rest of the parameters will be ignored, if they do not change the page content –for example, they could be some referral information, tracking info etc.
To define query string parameters, click Administration » Settings » Advanced » System » Content Locations » Page Default Canonical Url Settings » Allowed Canonical Url Query String Parameters and use the Create New button.
By default, a Sitefinity CMS parameter for paging is predefined in order to be preserved in canonical URL when paging that uses QueryString parameters is used.
Pagination links for static pages only
Each widget has a property named SetPaginationUrls, which controls weather to add the pagination URLs in the head of the page, if the content is paginated. The widget generates the previous and next links of the paginated series in the following way:
<link rel=”next” href=”http://localhost/next/page/of/paginated/series?with=parameters” />
<link rel=”prev” href=”http://localhost/previous/page/of/paginated/series?with=parameters” />
To property is enabled, by default. To disable it, open the widget for editing, click its Advanced button, and in SetPaginationUrls enter true or false. First, you must have enables canonical URLs.
Configuring canonical URLs for individual widgets
After you have configured the canonical URLs for the entire site, you can switch on and off canonical URLs for particular widgets.
It makes sense to do this only on pages where items are displayed in detailed view. For example, in order for an image to have canonical URL generated and inserted, you must publish a page with the Image gallery widget on it. When you browse this page, it does not create a canonical URL for the image until you click the image and display it in details view.
You can manage canonical URLs individually for the following widgets:
- News
- Event
- Image gallery
- Video gallery
- Download list
- List items
- Products list
- Dynamic content items
Created with the Module Builder
To configure canonical URLs on widget level, perform the following:
- Open the page where the widget is.
- Click the Edit button of the widget.
- Click Advanced.
- In field DisableCanonicalUrlMetaTag, perform one of the following:
- Leave empty
Canonical URLs remain as they are configured for the entire site.
- Enter false
Canonical URLs are generated when an item is opened via this widget.
- Enter true
Canonical URLs are not generated.
NOTE: If a canonical meta tag is already added to the <head>
tag of a page and the widget on the page is set to open content items in auto-generated page, you must delete the meta tag added to the page, by clicking the Actions link of the page, opening Titles & Properties and then expanding the Advanced settings.