Main Content

Magnolia Community Forums: Get help with Magnolia: Node link not working


  • pedro
    pedro
    Full name: Pedro
    Posts: 11
    Last post: Sep 26, 2017 12:51:35 PM
    Registered on: Jul 27, 2017
    Node link not working
    #1 by pedro on Aug 21, 2017 7:14:06 PM

    Hi to everyone,
    I want to link my results from searchfn to the page, not only to the component.
    At the moment I have:

    [#if queryStr?has_content]
    [#assign searchResults = mySearchfn.searchContent('website', queryStr, '/home', 'mgnl:component') /]
    [#assign recordsFound = searchResults?size /]

    <h3> <em>${recordsFound}</em> Results -> "${queryStr}"</span></h3>

    <div class="list-group">
    [#if searchResults?has_content]
    [#list searchResults as item]
    <a href="${cmsfn.link(item)}" class="list-group-item">
    <p class="list-group-item-text">${item.excerpt!}</p>
    </a>


    <p class="list-group-item-text">${item.page!}</p>
    <!--return:getPath() of the node (pointing to component) as String-->
    <p class="list-group-item-text">${item.pageLink!}</p>
    <!--return:path/to/page as String-->

    [/#list]
    [/#if]
    </div>

    [/#if]


    the url I get from <a> tag is something like "path/to/page/area/component", the problem is I can't see the full page, only the component.

    <a href="${cmsfn.contentByPath(item.pageLink, "website")}">link</a>

    given the example above, only builds the url as /page not building with full string (path/to/page)

  • tgregovsky
    tgregovsky
    Full name: Tomáš Gregovský
    Posts: 7
    Last post: Aug 22, 2017 7:37:51 AM
    Re: Node link not working
    #2 by tgregovsky on Aug 22, 2017 7:37:51 AM

    hello Pedro,
    try this:
    ${cmsfn.link(cmsfn.page(item))}

You don't have the permission to post on this thread

Sign in

To login on this forum, you can use your Magnolia Forge, Support or Partner account, or, below, your Google, Yahoo! or OpenID account. If you have trouble logging in, or any other sort of issue, please let us know in the Meta forum, on the user-list, or simply by email at forum-admin at magnolia-cms dot com.

* Required

... or sign in with:

  • icon http://{your-openid-url}
  • icon
  • icon https://me.yahoo.com/