0

I am using R 4.1.1, blogdown 1.4, and Hugo 0.81. I ran blogdown::check_site() and fixed all issues.

Hello. I have uploaded a PDF file Resume.pdf to my root directory in blogdown. In my YAML file, I have tried put this file in my header using this code:

menu:
  main:
    - name: Resume
      url: "./Resume.pdf"
      weight: 1

When I serve my website, if I click on "Resume" in my header from my home directory, the link works fine and I am served my PDF. However, if I click on "Resume" from anywhere else on the website, I am led to a 404.

I have currently gotten around this issue by using an absolute URL. However it would be nice to have a relative URL for efficiency purposes.

Does anyone know why ./Resume.pdf does not work in my YAML file?

Here is my full YAML file, with redacted parts replaced with ---

baseurl: ---
languageCode: en-us
title: Farzad Saif’s Website
theme: hugo-lithium
googleAnalytics: '---'
disqusShortname: ''
ignoreFiles:
  - \.Rmd$
  - \.Rmarkdown$
  - _cache$
  - \.knit\.md$
  - \.utf8\.md$
permalinks:
  post: /:year/:month/:day/:slug/
menu:
  main:
    - name: About
      url: /about/
      weight: 1
    - name: Papers
      url: /papers/
      weight: 2
    - name: GitHub
      url: ---
      weight: 3
    - name: LinkedIn
      url: ---
      weight: 4
    - name: Resume
      url: "./Resume.pdf"
      weight: 5
params:
  MathJaxCDN: //cdnjs.cloudflare.com/ajax/libs
  MathJaxVersion: 3.2.0
  description: Hello, I am Farzad Saif. Welcome to my website!
  favicon: favicon.ico
  highlightjsCDN: //cdnjs.cloudflare.com/ajax/libs
  highlightjsLang:
    - r
    - yaml
  highlightjsTheme: github
  highlightjsVersion: 9.12.0
  logo:
    alt: Logo
    height: 50
    url: logo.png
    width: 50

markup:
  goldmark:
    renderer:
      unsafe: true
  • 2
    Presumably your "other pages" have different paths/folders? Since you are hard coding the relative path in the header, it's only relative to your home directory. It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Aug 25 '21 at 22:10
  • I guess you almost surely mean `/Resume.pdf` instead of `./Resume.pdf`. The meaning of `.` depends on the context (the URL location of the current page). See the second bullet at the end of this page if you want to understand more about absolute/relative URLs (which can be difficult to understand): https://bookdown.org/yihui/blogdown/html.html – Yihui Xie Aug 26 '21 at 00:28
  • @YihuiXie I've tried "/Resume.pdf" but it just leads to a 404 from all pages, including Home. – Farzad Saif Oct 22 '21 at 18:18
  • @MrFlick Well this is a website, so I don't really have any data that I'm crunching. If it helps, my Resume is in a folder called "content." I will also paste my whole YAML file in the post. – Farzad Saif Oct 22 '21 at 18:24

0 Answers0