Uploaded image for project: 'Hippo Site Toolkit 2'
  1. Hippo Site Toolkit 2
  2. HSTTWO-4607

SPA++ site links in content do not stay in context relative to the sitemap item

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 5.6.0, 13.1.0
    • Fix Version/s: 13.3.1, 13.4.0, 14.0.0
    • Component/s: None
    • Labels:
      None
    • Similar issues:
    • Flagged:
      Flagged

      Description

      The issue

      The site link in the content of the resourceapi output is never in context of the current sitemapitem but always the 'canonical' or shortest path from the root. 

      Preferably the site link in the content tree should be in context to the current sitemapitem.

      The change

      The code that can be changed to support this new functionality is in the class

      HippoBeanSerializer

      in the method addLinksToContent where the selfLink is created the following line of code can be 

      final HstLink selfLink = requestContext.getHstLinkCreator().create(hippoBean.getNode(), selfMount);

      into the line that creates a link based on the requestContext instead of the mount

      final HstLink selfLink = requestContext.getHstLinkCreator().create(hippoBean.getNode(), requestContext);
      

      Reproduction path

      • Create a standard hippo instance from the archetype with content and news
      • Create a sitemap where
        • newsitems can be rendered below /news//default
        • and also below a specific content url in which you can link newsitems for instance: content/news/default
      • Make the mount also a spa++ mount with a resourceapi by adding the hst:pagemodelapi with value resourceapi
      • Create newsitems and the content item
      • Link a newsitem in the content item
      • Ask for the page of the contentitem in the resourceapi
      • In the content tree find the specific newsitem and look at the _links/site/href
        • the newsitem is linked to /news/[newsitem], instead of staying in the context of the content. It had to be /content/news/[newsitem]

      **Hopefully these steps are clear. If I have the time I'll try to recreate the specific steps with an archetype.

      Extra explanation of the issue

      The link created to a document in the content of the resourceapi under _links/site/href never stays in context of the current sitemapitem. This means that if I render newsitems under a toplevel news path element like www.site.org/news/newsitem and I also render the same newsitem in a context of a certain content item for instance global warming with a url like www.site.org/global-warming/news/newsitem that the link in the resourceapi content output of the global-warming call like .../resourceapi/global-warming to the newsitem should have a the last context link instead of the current root level link.

      • in the global warming content document there is a link to 'newsitem'
      • when resourceapi is called with .../resourceapi/global-warming
      •  look into the resourceapi output under the content element and look for the linked 'newsitem' document
        • the /content/[uuid-of-newsitem]/_links/site/href should contain the link within the context: /global-warming/news/newsitem
          • currently the link is /news/newsitem

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Matthijs Matthijs Tolkamp
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: