Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-111076

Canonical URL truncated to only host name for assets viewed by a Display Page Template

    Details

      Description

      Description

      When viewing a resource being displayed using a Display Page Template, the Canonical URL (rel="canonical") is truncated to only include the host name, instead of a specific asset URL that would be served to search engines as the preferred URL for that resource.  This happens because the getCanonicalURL() method in PortalImpl does not account for other URL separator types, so the parameters are lost.

      Steps to Reproduce

      1. Navigate to [Site_Administration] > Site Builder > Page Templates > Display Page Templates
      2. Create a new Display Page Template "Test Template," and select the following:
      Content Type: Web Content Article
      Subtype: Basic Web Content
      Note: I also added a "Display Page Content" to the template (under Section Builder > Content Display) to verify that I was correctly viewing an asset within the template
      3. Navigate to [Site_Administration] > Content & Data > Web Content, add a new Basic Web Content asset "Test Content" with some test text within the content body
      4. Before publishing the asset, use the right sidebar to add a friendly URL, and expand the "Display Page Template" to select Specific Display Page Template: Test Template
      5. Publish the asset, then select ⠇> View Content for the web content asset to view it using its display template
      6. In an incognito tab, open the asset using its friendly URL (http://localhost:8080/web/guest/w/testcontent1friendly, in my case) - note: verify at this step that the created Template is in use visually
      7. Open the browser's Inspect tools, then examine <head> (within Elements)

      Results of Testing

      Expected Result: For the <link> element that includes 'rel="canonical",' the href= value would have something that a search engine could use for pointing to the article
      Actual Result: The Canonical URL is truncated, as only the following is included:

      <link data-senna-track="temporary" href="http://localhost:8080" rel="canonical">

      Errors/Logs

      No errors

      Master

      Reproduced.
      Hash#: f449d2b173145eac4a8dbaedde4c9ffc84086a5a

      Branch

      Reproduced.
      Hash#: f7945b1e7941e42f6f7efca30d65cb0e924ea509

        Attachments

          Activity

            People

            Assignee:
            beck.liu Beck Liu
            Reporter:
            christopher.kian Christopher Kian
            Participants of an Issue:
            Recent user:
            Jason Pince
            Engineering Assignee:
            Christopher Kian
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              28 weeks, 4 days ago

                Packages

                Version Package
                7.2.10 DXP FP5
                7.2.10.2 DXP SP2
                7.2.X
                7.3.10 DXP GA1
                Master