7

The current link (Embedded Schema) supports external link or internal link (via Component linking). For internal linking, Tridion resolves the link if the Component is published on one or more Pages.

How can this internal link field be used to resolve documents (like PDF, Excel, Word etc.) ?

Suppose we modify the 'Link' Schema to allow the 'Internal Link' field to support 'Multimedia Links'; documents will still not work, because they also need to be present on some Page.

In short, how can a link Schema be used to support document (multimedia) links?

Edit

The link can be something like it is for images for e.g: "/media/PDF-Doc_tcm4-3247_w1024_n.PDF"

I even tried creating a dynamic template and published a PDF. But the link schema is not resolving the url. Its still looking for a page base I suppose. Is there any other way I can try (apart from DXA 1.2 upgrade :) )

2
  • 1
    Have you tried adding the Download Schema in the allowed Schemas for the Internal Link field? You might also need to check out our latest release (DXA 1.2) for that, since I know we have made some changes around support for media items in there. Nov 10, 2015 at 18:07
  • I tried this but getting null value. I think its still looking for a reference page. We do not have DXA 1.2 yet, SInce we have a release soon, the upgrade is not planned yet. Hope it is fixed there. Nov 12, 2015 at 5:45

2 Answers 2

4

I was also facing the similar problem and resolved with the below steps:

We need to use Default Multimedia schema and Chose Multimedia type "PDF" while creating the component. Attach this multimedia component to the 'Internal Link' field of Link schema and publish the relevant page.

enter image description here

Once the page is published you can check and confirm the published content to broker DB via ODData service for the reference to the pdf file.

However this does not gives the path of pdf yet. Please refer to fix below.

DXA 1.2 Code fix:

We have different type of STRATEGY in which the links are resolved as Binary link, Component link , or page link in DXA.

We have implementation class TridionLinkResolver.java implements LinkResolver which has the methods #resolveLink overloaded with two and three arguments, the third argument boolean resolveToBinary is the key to resolve the links as binary.

The ComponentLinkFieldConverter.java is the class and the method createComponentLink where it invokes the TridionLinkResolver.resolveLink with two arguments method as below:

final String url = linkResolver.resolveLink(componentId, null);

it does not check STRATEGY to resolve as Binary or Component link,

Changes needed here to check for multimedia and resolve that as binary as below

 String url = "";       

        if(null != component && null != component.getComponentType() && component.getComponentType().name().equalsIgnoreCase("Multimedia")){

            url = linkResolver.resolveLink(componentId, null,true);
        }
        else{

            url = linkResolver.resolveLink(componentId, null);
        }
7

Since DXA 1.1, Component Links to Multimedia Components are resolved as Binary Links (so a direct link to the MM Component's binary content).

I see you have tagged , which means that you will need DXA 1.2 (the first official DXA Java release).

3
  • You are correct, we are using 1.1. Also I want the binary link of published documents. "Since DXA 1.1, Component Links to Multimedia Components are resolved as Binary Links (so a direct link to the MM Component's binary content)." - Should this work then? or did you mean to say 1.2? Nov 12, 2015 at 5:47
  • 2
    @HustonLopes there is no DXA 1.1 for Java (the first offcial release for Java is 1.2, everything before that was simply a development snapshot and yes those were known to have defects), so you should either consider upgrading what you currently have to 1.2 or take a look at the differences between the version you have and what we use for linking in DXA 1.2 and fix the defect you found yourself. Nov 12, 2015 at 10:15
  • Yes, my mistake. We are using development snapshot then (0.5 or 0.6). We are considering 1.2, but not sure how soon. Meanwhile, can something be done by publishing documents with DCP and trying to get a link? or its same result? Nov 12, 2015 at 10:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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