Expand my Community achievements bar.

AEM Content Fragments and URL Rewriting | AEM Community Blog Seeding

Avatar

Administrator

BlogImage.jpg

AEM Content Fragments and URL Rewriting by SAULO VENANCIO - 3|SHARE Blog

Abstract

Have you ever wondered if you are using all the capabilities of AEM? Perhaps you are happy implementing basic components and templates. If that is enough for your application you can stop reading right here. But, if you're looking to do more, you have come to the right place, so continue reading!

AEM has evolved a lot in recent years. The “glorious” days of JSP development and jQuery alone are gone (if you are a developer you have your scars from that time). Here at 3|SHARE, we adapt to the changing times to provide our clients with the latest and greatest solutions.

AEM Content Fragments are a great example of this evolution, and the main topic of this article. In a recent project, we capitalized on this feature creating Content Fragments that enable authors to create Authors Information, Calendar Events and User Walkthroughs.

AEM ships with a Content Services JSON exporter, which can be used by the UI to render content from AEM. But in our case, for the Calendar Event mentioned, there was one feature missing in the out-of-the-box content fragment exporter.

Although AEM allows you to set up URLs in the content fragment, the JSON exporter doesn’t do the URL rewriting for you.

Why do I need URL Rewriting for Content Fragments?
URL rewriting is a way of implementing URL mapping or routing within a web application. AEM websites usually have a base content path like /content/mywebsite/country_language. This is not optimal for a live website as it doesn't add any value in terms of SEO or for the users. In order to have better user-friendly URLs you'll need a URL Rewriting mechanism. Utilizing this, your website's URL could look like: http://www.mysite.com/country_language.html.

However with the out-of-the-box JSON exporter from the AEM Content Services this URL rewriting doesn’t happen by default when the URL is a property of a Content Fragment.

Building the solution
The most common solution for this issue would be to build a custom content fragment model based on the one shipped with AEM. Now imagine you have multiple types of content fragments exposed. You would need to create a new custom content fragment model for each type just to solve the issue resulting in many models and probably some duplicated code.

Read Full Blog

AEM Content Fragments and URL Rewriting

Q&A

Please use this thread to ask the related questions.



Kautuk Sahni
Topics

Topics help categorize Community content and increase your ability to discover relevant content.

0 Replies