Hello
I guess the picture helps to understand the issue:
I am uploading a file. I drag-and-drop it in the textfield (type: editor). The article renders like this:
It looks ok, but the file in the text is linking to my internal page on my localhost (http://kirby/panel/pages/blogs+woran-erkenne-ich-corona/files/coronaerkennen.pdf ), not the correct domain. The button under the text is working as expected.
Perhaps that is even the intended behaviour? If so: How do I add a clickable link inside the text that starts a download of the PDF?
Here is the code of the blogpost. The issue is inside the
<?= $subpage->text()->blocks() ?>
so I guess that my HTML/PHP is not really relevant here. But who knows.
<div class="card-body">
<h3 class="card-title"><?= $subpage->title() ?></h3>
<p>
<?= $subpage->text()->blocks() ?>
</p>
<div class="container bg-gradient rounded">
<?php if ($file = $subpage->downloads()->toFile()) : ?>
<h5 class="lead mt-5 text-black">Passende Downloads</h5>
<?php $dateien = $subpage->downloads()->toFiles();
foreach ($dateien as $datei) : ?>
<a href="<?php echo $datei->url() ?>" download="<?php echo $datei->filename() ?>" class="btn btn-primary mt-2">
<svg class="bi" width="24" height="24">
<use xlink:href="<?= $kirby->url('assets') ?>/icons/bootstrap-icons.svg#info-square" />
</svg>
<?php echo $datei->name() ?>
</a>
<?php endforeach ?>
<?php endif ?>
</div>
</div>
texnixe
September 13, 2020, 10:23am
#3
Hm, I’m not sure if this is even supposed to work, because there is no file block type. There is a feature request for a file block type: https://github.com/getkirby/editor/issues/223
Please feel free to create an issue on GitHub, though.
For the moment, you could create your own file block tag or use a kirbytag block instead.
That would be loosing the features of the editor, right?
In that case I will stick to create a Link-list with PHP as before and what for Kirby 3.6 or something
BTW: I simply expected this to work, it feels like an intuitive thing to do. I will open a feature request
Thanks for your quick reply on a sunday
texnixe
September 13, 2020, 11:00am
#6
Thanks, I moved it to the editor repo-