+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / A few questions about canonical urls

A few questions about canonical urls

13 posts, 0 answered
  1. Beth
    Beth avatar
    29 posts
    Registered:
    30 Oct 2013
    16 Jul 2015
    Link to this post

    Hello!

     I am trying to work on my first Sitefinity site - it was initially developed by a vendor and I'm trying to learn Sitefinity to make updates. (Just to let you know my experience level and, thus, how basic of a response I need.)

     Question/problem #1:

    I've allowed canonical urls and they are showing up in the source of my pages, but they show as http:// and I would like them to show as https://. I can't seem to find a setting that would allow for this, but know I'm probably missing something. Can someone help me out?

     Question/Problem #2:

     ​The developers created some custom modules that work a bit like the default Sitefinity blog/news modules. Unlike them, however, I can't seem to find a way to get per entry canonical urls. For example:

     A category page onto which I've placed the module widget:

    https://www.ufcu.org/personal/learn/tools-advice/financial-advice/establish-your-finances

     Article level pages:

    https://www.ufcu.org/personal/learn/tools-advice/financial-advice/establish-your-finances/5-money-tips-for-new-graduates

    https://www.ufcu.org/personal/learn/tools-advice/financial-advice/establish-your-finances/advice-for-graduating-college-students-looking-for-work

    These all show the same canonical url in the source - that of the category page into which the custom news module has been dropped. Inside that widget, I don't have the options that exist in the standard blog widget that allow for the article urls to become the canonical url. My options are very limited (see attached screen grab) - I usually just change the category name so that the list view shows the posts from the category I want to show. 

     Does anyone have any advice or can point me to help on  how to get the canonical urls of the articles to, I guess, float up to the  main template and override the page url?

     Thanks!

  2. Velizar Bishurov
    Velizar Bishurov avatar
    143 posts
    Registered:
    28 Sep 2016
    21 Jul 2015
    Link to this post
    Hello,

    Regarding the first question. The url is retrieved from the Site URL settings. You can get more information about this in the "Configuring canonical URLs" section of our documentation article about enabling and disabling Canonical URLs service.

    Regarding the second question. You seem to be missing the point of the canonical URLs. They serve to show the default page on which the item is displayed. Therefor all the articles on that page will have the same canonical URL. You can read further about the conception of canonical URLs in our documentation article here as well as in this article by google here.

    Regards,
    Velizar Bishurov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Beth
    Beth avatar
    29 posts
    Registered:
    30 Oct 2013
    21 Jul 2015 in reply to Velizar Bishurov
    Link to this post

    Perhaps I'm not explaining my problem properly, but I do understand the point of canonical URLs. They are to provide a single, always will work URL to a piece of content that might be accessible via multiple URLs. Essentially, multiple URLs might point to the same piece of content, but only one of those URLs is canonical. ​ Multiple pieces of content should not have the same canonical URL - which is what is happening on my site now. I need to know how to get the article/content URL up into the canonical URL field instead of the url for the page on which the widget is dropped. I'm just trying to get the custom modules to function like the default blog/news modules. 

     I've attached screen grabs of the settings mentioned in the documentation you linked to. What is set incorrectly? Why am I getting http in my canonical URLs and not https? I see no place to pick the default protocol (just the port).

    Also, I'm still not getting consistent canonical urls no matter how I access the site. If I go with them or via a different subdomain, the canonical URLs change to the subdomain used instead of remaining www. I want the canonical URLs to remain the same no matter how the site is accessed - no matter the domain or subdomain used.

  4. Velizar Bishurov
    Velizar Bishurov avatar
    143 posts
    Registered:
    28 Sep 2016
    24 Jul 2015
    Link to this post
    Hi Beth,

    Judging by the screenshot from your first post the vendor has made you a custom widget that display your content items. By default Sitefinity does not recognize content displayed using custom widgets unless they implement the IContentLocatableView interface. You can read more about it in our documentation article about registering content location with custom widgets. This is why when you click on a particular article Sitefinity sets the canonical url to the actual page as it does not recognize that there is content there.

    Regarding the https link can you please check that the page is set to require ssl. You can take a look at our documentation article about configuring SSL for how to do this.

    Regards,
    Velizar Bishurov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  5. Beth
    Beth avatar
    29 posts
    Registered:
    30 Oct 2013
    05 Aug 2015 in reply to Velizar Bishurov
    Link to this post

    Thanks for the reply. I'm still trying to sort out how to perform the information in the first paragraph of you reply. 

     In regard to https showing on the canonical urls, the box you indicated I should uncheck in URL settings was already unchecked - and our canonical urls still start with http:// instead of https. Am a missing something in the setting screen? (see attachment)

  6. Velizar Bishurov
    Velizar Bishurov avatar
    143 posts
    Registered:
    28 Sep 2016
    07 Aug 2015
    Link to this post
    Hi,

    Regarding the content locations. Your custom widget needs to implement the "IContentLocatableView" interface in order for Sitefinity to set correct canonical url links. You can follow our documentation article about this.

    Regarding the https. I was refering to the "Requries SSL" checkbox on the page's Title & Properties. You can check that by clicking more actions on the page, clicking Title & properties and scrolling to the advanced section.

    Regards,
    Velizar Bishurov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  7. Beth
    Beth avatar
    29 posts
    Registered:
    30 Oct 2013
    07 Aug 2015 in reply to Velizar Bishurov
    Link to this post

    Yes, I understand that you are pointing to a method I need to implement, but I'm not a Sitefinity developer, so I don't know where/how to try and implement that. I'm trying to learn and do appreciate you letting me know what I need to look at to accomplish this, but I still need to learn some stuff before I can get there.

     

    Do you mean I have to go in and check that box on all of our pages one at a time? We have a lot of pages...

  8. Beth
    Beth avatar
    29 posts
    Registered:
    30 Oct 2013
    13 Aug 2015 in reply to Beth
    Link to this post
    Any reply to the question about having to check the "Require SSL" box on every piece of content? Because that's not really an option for us as we then won't be able to sync content between our dev (non-SSL) and live (SSL) environments.
  9. Velizar Bishurov
    Velizar Bishurov avatar
    143 posts
    Registered:
    28 Sep 2016
    14 Aug 2015
    Link to this post
    Hi,

    You can use the following code on a web form's code-behind for example to set the Requires SSl property on all frontend pages programmatically. You can further filter the pages if needed.

    var pageManager = PageManager.GetManager();
     
    var pageNodes = pageManager.GetPageDataList()
        .Where(pd => pd.NavigationNode.RootNode == SiteInitializer.CurrentFrontendRootNodeId)
        .Select(pd => pd.NavigationNode);
     
    foreach (PageNode pageNode in pageNodes)
    {
        pageNode.RequireSsl = true;
    }

    Regards,
    Velizar Bishurov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  10. Beth
    Beth avatar
    29 posts
    Registered:
    30 Oct 2013
    14 Aug 2015 in reply to Velizar Bishurov
    Link to this post
    Thanks. I guess I could look into switching based on domain so that it wouldn't require ssl on our development servers.
  11. Susan
    Susan avatar
    8 posts
    Registered:
    23 Aug 2011
    11 Apr in reply to Velizar Bishurov
    Link to this post

    I am attempting to use this code but it does not actually save the changes at any point to the page.  If I try to call the SaveChanges then I get an error "Cannot use SaveChanges or CancelChanges on instance manager that was specified to use global or distributed transaction. Instead, use TransactionManager static methods CommitTransaction(string transactionName) or RollbackTransaction(string transactionName)."  How can I set all pages to requireSSL on site load?

     

    PageManager pageManager = PageManager.GetManager(null, Guid.NewGuid().ToString());
                using (new ElevatedModeRegion(pageManager))
                {
                    var pageNodes = pageManager.GetPageDataList()
                        .Where(
                            pd =>
                                pd.NavigationNode.RootNode.Id == SiteInitializer.CurrentFrontendRootNodeId &&
                                !pd.NavigationNode.RequireSsl)
                        .Select(pd => pd.NavigationNode);
                    foreach (PageNode pageNode in pageNodes)
                    {
                        pageNode.RequireSsl = true;
                    }
                    pageManager.SaveChanges();
                }

  12. Velizar Bishurov
    Velizar Bishurov avatar
    143 posts
    Registered:
    28 Sep 2016
    14 Apr
    Link to this post
    Hi,

    The problem is that you are explicitly specifying a transaction name when getting the manager. Either use the GetManager method without the second parameter or save the new guid in a variable and use the following static method with the guid as parameter:

    TransactionManager.CommitTransaction("GUID");

    Regards,
    Velizar Bishurov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  13. Susan
    Susan avatar
    8 posts
    Registered:
    23 Aug 2011
    14 Apr in reply to Velizar Bishurov
    Link to this post
    Thanks for replying - I figured that out after asking and should have updated.  I removed the parameters and savechanges worked fine.
13 posts, 0 answered