Next: , Previous: Publishing options, Up: Configuration


13.1.6 Links between published files

To create a link from one Org file to another, you would use something like ‘[[file:foo.org][The foo]]’ or simply ‘file:foo.org.’ (see Hyperlinks). Upon publishing this link becomes a link to foo.html. In this way, you can interlink the pages of your "org web" project and the links will work as expected when you publish them to HTML.

You may also link to related files, such as images. Provided you are careful with relative pathnames, and provided you have also configured org-publish to upload the related files, these links will work too. See Complex example for an example of this usage.

Sometime an Org file to be published may contain links that are only valid in your production environment, but not in the publishing location. In this case, use the property

:link-validation-function Function to validate links

to define a function for checking link validity. This function must accept two arguments, the file name and a directory relative to which the file name is interpreted in the production environment. If this function returns nil, then the HTML generator will only insert a description into the HTML file, but no link. One option for this function is org-publish-validate-link which checks if the given file is part of any project in org-publish-project-alist.