Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pdf not loading #534

Closed
3 tasks done
cnut1648 opened this issue Jan 20, 2022 · 2 comments · Fixed by #550
Closed
3 tasks done

pdf not loading #534

cnut1648 opened this issue Jan 20, 2022 · 2 comments · Fixed by #550

Comments

@cnut1648
Copy link
Contributor

cnut1648 commented Jan 20, 2022

Acknowledge the following

  • I carefully read and followed the Getting Started guide.
  • I read through FAQ and searched through the past issues, none of which addressed my issue.
  • The issue I am raising is a potential bug in al-folio and not just a usage question.
    [For usage questions, please post in the Discussions instead of raising an issue.]

Describe the bug

Hi, I have a page in the _posts that looks like this

---
layout: page
title: "A Title"
categories:
 - cat1
 - cat2
nav: true
permalink: /files/1.pdf
---

and I have put a 1.pdf in the files folder. However when I open that post, although the link indeed is redirected to the xxx/files/1.pdf, I receive the error

Failed to load PDF document.

image

I'm wondering what might cause such issue. I double checked that I can open the pdf just fine using local machine; and I also think my syntax is correct: I tried to do something similar for the CV and it was fine; and I checked that the permission is 777 (not sure if this is important).
Thanks!!!

System (please complete the following information):

  • OS: manjaro
  • Browser (and its version) Chromium 96.0.4664.110 Arch Linux
  • Jekyll version 4.2.1
  • Ruby version ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-linux]
@cnut1648 cnut1648 added the bug label Jan 20, 2022
@alshedivat
Copy link
Owner

I'm not sure if the way you are trying to link a PDF is standard for Jekyll. I'm getting the same error and the following message in the console during the local build:

Conflict: The following destination is shared by multiple files.
The written file may end up with unexpected contents.
/Users/maruan/Documents/dev/al-folio/master/_site/assets/pdf/example_pdf.pdf
 - /Users/maruan/Documents/dev/al-folio/master/assets/pdf/example_pdf.pdf
 - /Users/maruan/Documents/dev/al-folio/master/_posts/2022-01-15-pdf.md

what happens is that Jekyll generates HTML blog page that overrides your original PDF. all the generated files are located under _site/ folder. you can check this by looking at _site/files/1.pdf in your case. I don't think you can redirect a blog post page to a PDF file via permalink. one way to go about this is add redirect field to the blog post header and add some custom logic to blog/index.html that handles it.

supporting blog posts that redirect users to arbitrary pages (including PDFs) would be a nice feature. it would be awesome if you could send a PR!

@cnut1648
Copy link
Contributor Author

cnut1648 commented Feb 1, 2022

Thanks!! I created a PR #550 for this!! This is now working fine in my website

@cnut1648 cnut1648 closed this as completed Feb 1, 2022
@alshedivat alshedivat linked a pull request Feb 20, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants