0

I'd like to suggest to my technical team (DD4T Java) a DD4T version of In-page Component Presentation-based Navigation. In other words, we want to create something like the following.

<ul>
  <li><a href="#CP1"></li>
  ...
  <li><a href="#CPN"></li>
</ul>

On the same page we have the Component Presentations (CPs):

<div id="CP1">...</div>
...
<div id="CPN">...</div>

Bookmark link and matching ID might be based on order, title, or "heading" fields. This is not Structure-Group based Navigation as mentioned in Robert's question.

This seems equivalent to one of Harold's answers, that includes:

  • "Widget" -- New Component Template (and maybe dummy Component) to output the details
  • Matching DD4T ComponentPresentationRenderer calls the action to output navigation

At a high-level, what should my developer work on to get the Component titles (or select fields) from the CPs on a given page?

  • Would a view for each link make sense?
  • Should the bookmark link markup go in the page view?

Assumptions:

  • The navigational links are not on every page. They would be added to a page via Page metadata (include bookmark nav option or with a "Widget" CP that editors place on the page)
  • The markup would ideally be the same, but may differ by pages (abstracting the links would be a good idea)
  • Pages embed CPs dynamically (on the page, but with dynamic Component Templates)
1

Would go for a custom page template;

In here you create for the location of the navigation

<c:forEach var="componentPresentation" items="${pageModel.componentPresentations}">
<li><a href="#${componentPresentation.component.title}>${componentPresentation.component.title}</a></li>
</c:forEach>

(for the spaces you can create a custom function)

And on the content location where the components come you keep the normal repeat of component presentations;

<dd4t:componentpresentations />

Make sure the componentPresentations have some kind of identifier that matches the ankers in the top navigation.

Hope this answers you question or a direction;

  • A Page Template works. For identifiers, we could use something from the Component and Template and maybe the position just in case of duplicates. – Alvin Reyes Jul 17 '15 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.