How to add a relative link to a file uploaded to the page?

Hi!

I have a pdf uploaded to a page that I want to link to in a writer block. I don’t want to use an absolute path to the file, since the domain is likely gonna change in the future. However if I use a relative link like so:

../media/pages/projects/birthday-greetings-to-a-landscape/2154cd2aef-1697391872/party-invitation.pdf

the anchor tag doesn’t get any href attribute.

Is there another way to do this?

You should make it use Kirby-internal linking with the url() helper or something like that. So you can use relative paths on your site but it will automatically convert them to absolute paths, depending on where your site is located on the server/in the domain name system.

You shouldnt link directly to files in the media folder as this folder is always in flux, and managed by kirby. Getting kirby to generate absoloute paths will be fine, as kirby takes care of all that. The links wont break if you change to another domain.

I see your points! So there is no real option of including a (relative) link to a file within a writer block? In a textarea field I can easily upload a file and link to it but that’s not possible in a writer block.