I have a PDF that the client is supposed to upload via the panel and that the site users can open into a new tab. Since apparently the PDF gets copied to the media folder, the resulting url when opening the pdf is something like this:
I don’t know if that’s possible tbh, but you might want to keep it as is because it’s really nice to cache-bust updates, especially with those pesky pdf files.
Note that in the example above, this will only work if your file is called test.pdf, you would have to adapt the route to your real filename and if it’s not only that one file, you have to make the route dynamic.
Ok, I think I got the template part set up correctly. However, the routing option that you suggested above does not seem to work. I always get taken back to my home page instead of having it open the pdf.
I have a default.php template set up that contains the line <?php go('home') ?>, I wonder if this overwrites the routing somehow?
And the file is really called test.pdf? But the route searches for the file in site() not in the home page… So that doesn’t make sense and you have to change it to your location.
Ah, okay. I thought site()->file('test.pdf') would globally search and return the given file. Sorry for the confusion. Changed the route now to site()->homePage()->file('test.pdf') and it works.