jpr
jpr

Reputation: 185

CQ5.6.1 Text component in the footer to pass same content across all pages

I have a footer.jsp which is expected to appear same across all pages. I added a Text component in the footer.jsp. When the author adds content to this Text component in Home page, I want the content to reflect in the footer of all child pages. Here is how I use the text component in the footer.jsp, but this is not working as I want.

<div class="gelUpdateContent">
    <cq:include path="text" resourceType="foundation/components/text" />
    Get Live Great <span class="txtRed">updates </span>
</div>

I already tried iparsys component instead of text, which is useful, but then my requirement is to restrict it to text only.

Any help is highly appreciated. Thanks.

Upvotes: 0

Views: 414

Answers (3)

Jitendra S.Tomar
Jitendra S.Tomar

Reputation: 53

Well, We can design with following options:

  1. It is depend on your requirement. If you want to have common footer across the site then Put some global path(i.e /content/rootSitePath/) as a cq:include path.

  2. If you want to have footer information get updated on child pages only then use IParsys component.

I would prefer to use option 1, but make sure we are hard coding path. Bette to have utility to determine path.

Thanks, Jitendra

Upvotes: 0

Rajesh Pantula
Rajesh Pantula

Reputation: 10241

I agree with @rakhi's answer of providing absolute path. But there is another way to do this.

Try using iParsys. iParsys configuration is inherited by all child pages. if you include an iParsys and drag-n-drop your footer component in the root page of your site, then that footer component will start appearing in all your child pages.

Upvotes: 1

rakhi4110
rakhi4110

Reputation: 9281

Instead of providing relative path to the path property in cq:include i.e. (text), provide an absolute path, something like (/content/<project>/<homepage>/jcr:content/text).

Providing relative path creates the text node under each page, whereas absolute path ensures that all the pages read and write to the node present in the path provided always.

This is one way of achieving what you need.

More info on using cq:include can be found here

Upvotes: 0

Related Questions