I am having trouble accessing the pdf file on my website. Whenever I click on the link “view my resume” It says “Looks like you’ve followed a broken link or entered a URL that doesn’t exist on this site”. I have checked all my file path and I am 100% sure that I am giving the correct relative file path. When I run "npm start’ from the terminal, I am able to view the pdf file. But when I try to run the website directly from netlify or GitHub or from outside the computer. It does not work. Please help. I want that anyone can view my resume on any computer lol.
Hi, @prateekgurnani10, and welcome to our Netlify community site.
We’re happy to troubleshoot this but we need more information to do so. What is the actual URL for the PDF which isn’t working?
There is no URL for the pdf file. I have given a relative path to href attribute in the anchor tag. It works when i type npm start from the terminal and then click on view my resume. But when I open from outside using GitHub or netlify, It doesn’t.
hey @prateekgurnani10 - it might be because because you’ve placed the pdf file in the
src folder, or, there is something somwhere that has a case mismatch? Maybe the link goes to
prateek_resume.pdf? Those are not the same things on a linux based system, which sort of explains why this might work locally but not remotely.
your best bet is to always standardize everything in lowercase.
Could this be the problem?
@perry I made it lowercase still the same problem. I have tried my level best but still cannot troubleshoot this problem. Idk what’s the reason? It opens locally when i type npm start in the terminal. But if i directly open my website from github or netlify then its a problem.
Hi, @prateekgurnani10, I found the issue. The PDF file is not being included in the publish directory for this site build. Because it isn’t in the publish directory, it doesn’t get uploaded to our CDN. Only files in the publish directory become part of the deployed site.
The publish directory is set here:
That directory is
dist. You can also download the published deploy here:
This is done using the download deploy button shown here:
When you download the deployed files, please note there are no PDF files there.
To resolve this issue, the PDF should be copied to
dist/src/assets/prateek_resume.pdf (relative to the base directory of the repo) during the site build. This will cause the URL for the PDF file to work.
Alternately, you can place that file elsewhere (somewhere under the publish directory) and adjust the URL accordingly to match the correct location. If example, if you copy the PDF to just
dist then the path would be
/prateek_resume.pdf instead of
I also see the file in the repo (which is public) as being
prateek_resume.pdf so please consider that as well. The Linux filesystem we use for builds is case-sensitive.
If there are other questions, we’re happy to answer.
@luke Thanks for your response. I will try it out.
@luke I deleted everything and started from the beginning. I have added prateek_resume.pdf in dist/src/assets folder. when i type npm run build in the terminal and then npm start, it still gives me this error “cannot get /src/assets/prateek_resume” . i checked the assets folder in the dist directory and my file prateek_resume gets deleted.
can show us a screenshot of your directory structure after you build, please?
the file gets deleted everytime from the assets folder after i build. As you can see there is no prateek_resume in assets folder after i build. @perry
which static site generator are you using?
Hi, @prateekgurnani10, I believe that file must be specifically loaded by the webpack build. I think the following StackOverflow Q&A can assist with this: