Expand my Community achievements bar.

SOLVED

Automatically adding references to subsections at the end of each topic

Avatar

Level 2

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.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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.

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

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.

Avatar

Community Advisor

@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.

Avatar

Community Advisor

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 .