Automatically adding references to subsections at the end of each topic | Community
Skip to main content
Level 2
June 4, 2020
Solved

Automatically adding references to subsections at the end of each topic

  • June 4, 2020
  • 3 replies
  • 3424 views

I'm looking for a way to automatically add references to subsections at the end of each topic. Is there any way to do this using AEM? I am using AEM 

 

That is, if I have a topic at level 1 and 3 topics at level 2, I am looking at ways to insert links automatically to the end of the topic with links to the topics at level 2,preferably as an unordered list.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Shashi_Mulugu

Assuming you are referring topic as page in AEM sites, you are building a blog kind of website where you want to display all topics.

 

You can develop a sling model which will get current page as source and get all child pages, if need recursively  (You can always put some page properties to hide some topics from referring ) and display in the parent page.

 

Call the model in page component so that whenever a page is created a top-levels, child pages are automatically pulled up.

3 replies

Shashi_Mulugu
Community Advisor
Shashi_MuluguCommunity AdvisorAccepted solution
Community Advisor
June 4, 2020

Assuming you are referring topic as page in AEM sites, you are building a blog kind of website where you want to display all topics.

 

You can develop a sling model which will get current page as source and get all child pages, if need recursively  (You can always put some page properties to hide some topics from referring ) and display in the parent page.

 

Call the model in page component so that whenever a page is created a top-levels, child pages are automatically pulled up.

BrianKasingli
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
June 4, 2020

@anish2,

One other approach is to use AEM Tags (cq:Tags). You can tag all blog article pages, then add an additional page property configurable, with an option to choose one or more cq:Tags of for "showRelatedPages".

The blog article page will display all the related pages in a list view of all the pages that are tagged with the correct tagging based on the page property.

This work will include a new AEM Component, with Sling Model backend logic.

It would also make sense to tag all your blog article pages, so you can easily query for pages that are categorised in the same category for the future.

VeenaVikraman
Community Advisor
Community Advisor
June 5, 2020
I Agree
VeenaVikraman
Community Advisor
Community Advisor
June 5, 2020

I think one of the best approach considering the capabilities of AEM is to use tags as suggested by @briankasingli . U can tag any page at any level with a meaningful tag. Write a component which will pull latest articles based on your tags .