there is one aspect to Kirby, that I don’t understand.
You link to a file like this:
a) (file: impulspapier.pdf text: Impulspapier)
or
b) (link: /content/1-aktivitaeten/impulspapier.pdf text: Impulspapier)
if you have uploaded it to an other page.
If a user saves or mails the direct link then, she/he get’s
Keep in mind that if you rename a page folder, even file l links without folder numbers will no longer be valid. If this is likely to happen, you might consider using a dedicated file folder.
If I want links to files without numbers, I can make a copy of the Kirbytags, e. g. file2. Then I write (file2: aktivitaeten/impulspapier.pdf) and the user gets http://domain.de/content/aktivitaeten/impulspapier.pdfinstead of http://domain.de/content/1-aktivitaeten/impulspapier.pdf. Then I can change the order in den menu without destroying the direct link until I rename the page folder. That’s the same basic principle in Wordpress, even the implementation is different.
So I will agree with your last comment.
Furthermore, I have questions, to understand the philosophy of Kirby.
You wrote, that I could modify the Kirbytag file. In the handbook stands, where to save the modifyed Kirbytag.
This is a custom file method that generates a link without the prepended numbers.
Copy the following code into file.phpand save in /site/tags:
<?php
kirbytext::$tags['file'] = array(
'attr' => array(
'text',
'class',
'title',
'rel',
'target',
'popup'
),
'html' => function($tag) {
// build a proper link to the file
$file = $tag->file($tag->attr('file'));
$text = $tag->attr('text');
if(!$file) return $text;
// use filename if the text is empty and make sure to
// ignore markdown italic underscores in filenames
if(empty($text)) $text = str_replace('_', '\_', $file->name());
return html::a($file->permanentURL(), html($text), array( // this line uses the new method instead of the url() method
'class' => $tag->attr('class'),
'title' => html($tag->attr('title')),
'rel' => $tag->attr('rel'),
'target' => $tag->target(),
));
}
);
This is an exact copy of the file tag from/kirby/extensions/tags.php with the only difference that it now uses the custom file method from above to create the url. The new tag thus overwrites the original tag.
In your text file, you call the tag as before:
(file: aktivitaeten/impulspapier.pdf)
If you don’t use the tag, but instead you want to get the URL of a file directly in your template, also use the above method instead of the url() method