Hugo seems to be treating a linked PDF as a "page"

I have several pdfs linked in my Hugo site using standard markdown links - e.g.,

[Title](/folder/filename.pdf)

where the folder is in my static folder.

When I build my site, I get an error for each PDF:

WARN  Page '/documents/handwritten/calculus/Limits_Intuitive.pdf' not found in 'handwritten/calculusnotes.md'

However, in both the local build and the deployed build, the links work just fine. When I put an image file in the same folders, I get no errors.

Any ideas on what the issue might be? It seems to me that Hugo is treating the .pdf files as pages. I know I could just ignore or suppress the error, but I want to understand the issue.

I’m pretty sure the warning above does not come (directly) from Hugo.

My best guess is that your site source (or theme) has a link render hook that has an wrong assumption that every link is a page/page resource. But I’m guessing a little.

1 Like

Thanks for the suggestion (I’m using the “Book” theme, which I like for its simplicity). I’ll definitely follow this line of inquiry!

EDIT: Found the issue! I disabled this setting in the config file and all is well.

# Portable links meant to work with text editors and let you write markdown without {{< relref >}} shortcode
# Theme will print warning if page referenced in markdown does not exists.
BookPortableLinks: false

Here’s the page.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.