Jahia Template Forum > How do I link to...

0 (0 Good)
0 (0 Bad)

How do I link to contents and files

by  gs »  2014/04/24 06:50

Hi I'm new to Jahia, and was trying out Jahia 7. I was trying to construct a page template (via html/jsp coding) and had a hard time trying to figure out how to specify links to contents and static assets. I think I'm missing some fundamentals. Can anyone point me to documents or code examples that illustrate the following use cases:

1. Linking to a file contained within the resource folder of a template set or module: /src/main/resources/<myfolder>/<filename>

2. Linking to a file contained within the files repository of a template set or module: <module>/files/<filename>

3. Similar to above, but file is in the "templates" folder (what's the difference anyway? this is confusing...): <module>/templates/files/<filename>

4. Linking to a file contained in the site's file repository: <site>/files/<filename>

5. Linking to a content (e.g. richtext) contained in the site's content repository: <site>/contents

6. Similar to above, but for contents in the template set or module: <module>/contents

7. As #5, but for contents in the "templates" folder of the template set or module: <module>/templates/content

Assuming that all of the above are valid use cases, when do I use each one?

 

 

 

 

  (gs)

Number of messages  2
Registration date
0 (0 Good)
0 (0 Bad)

Re: How do I link to contents and files

by  gs »  2014/04/28 02:13

I have figured out myself the following:

1. Linking to a file contained within the resource folder of a template set or module: /src/main/resources/<myfolder>/<filename>

- I can use <c:url value='${url.currentModule}....' />

- Apparently only certain folder names are allowed (javascript, css and img). Is this correct?

 

2. Linking to a file contained within the files repository of a template set or module: <module>/files/<filename>

- Still looking for the answer.

 

3. Similar to above, but file is in the "templates" folder (what's the difference anyway? this is confusing...): <module>/templates/files/<filename>

- This actually seeds the files to the site (#4) during initial site creation, so the original question is meaningless.

 

4. Linking to a file contained in the site's file repository: <site>/files/<filename>

- The approach I found from reading the github examples is uses ${renderContext.mainResource.node.resolveSite}, then <jcr:node path="..." /> and then get the url attribute of the node. Is there a more direct way?

 

5. Linking to a content (e.g. richtext) contained in the site's content repository: <site>/contents

- Still looking for the answer.

 

6. Similar to above, but for contents in the template set or module: <module>/contents

- Still looking for the answer.

 

7. As #5, but for contents in the "templates" folder of the template set or module: <module>/templates/content

- I think this is the same situation as #3, but for contents, so this question is meaningless.

 
 
gs
Number of messages  1
Not registered
Contact
Share
Feedback

Get in touch

Whether you are a current user or if you are just evaluating Jahia, we are here to help.

Contact us

Share this page