Expand my Community achievements bar.

SOLVED

Can you redirect to a .PDF?

Avatar

Level 2

I know how to redirect to a page...but do not know how to redirect to a .PDF. For example I want the title in the MegaMenu but simply redirect to the PDF, not to a page. Is this possible?

1 Accepted Solution

Avatar

Correct answer by
Level 8

That's because OOTB the redirect functionality checks to see if the location is internal or external (see /libs/foundation/components/page/page.jsp).  If it determines it's internal (i.e. doesn't contain :/) then it appends .html

You could overlay the page.jsp in your page component and check to see if ".pdf" exists, and if it does, don't append .html and if it does, just perform the redirect.

View solution in original post

6 Replies

Avatar

Level 10

What version of AEM are you using?

Avatar

Level 10

Instead of providing link to a page, provide the path to .pdf file

It should work

Avatar

Level 8

You can absolutely do that by either pointing to the asset in the DAM, or by specifying an absolute URL.  The trick from an SEO perspective is that you'll want to open it in a new window so you keep people on your site.  We typically use a link helper class where the link path/url is passed into a sightly class and the logic determines whether it's an internal page and needs to be appended with .html, or whether it's external/an asset, and will set the _blank attribute on the anchor.

Avatar

Level 2

When I go the advanced tab under properties, and use the redirect, I see the file as a .pdf. However, when I go to the live version it wants to take me to a.html. ???

Avatar

Correct answer by
Level 8

That's because OOTB the redirect functionality checks to see if the location is internal or external (see /libs/foundation/components/page/page.jsp).  If it determines it's internal (i.e. doesn't contain :/) then it appends .html

You could overlay the page.jsp in your page component and check to see if ".pdf" exists, and if it does, don't append .html and if it does, just perform the redirect.