# Referencing a pdf works, but there is a warning on startup

**URL:** <https://discourse.gohugo.io/t/referencing-a-pdf-works-but-there-is-a-warning-on-startup/53116>\
**Category:** support\
**Created:** [January 14, 2025, 3:33am UTC](https://discourse.gohugo.io/t/referencing-a-pdf-works-but-there-is-a-warning-on-startup/53116 "2025-01-14T03:33:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![djsamperi](https://avatars.discourse-cdn.com/v4/letter/d/e9c0ed/32.png) [@djsamperi](https://discourse.gohugo.io/u/djsamperi)\
**Post date:** [January 14, 2025, 3:33am UTC](https://discourse.gohugo.io/t/referencing-a-pdf-works-but-there-is-a-warning-on-startup/53116/1 "2025-01-14T03:33:54Z")

</div>

I’m referring to a pdf using in a markdown file using `[foo](/images/smile.pdf)`,  
and it works fine, the pdf is displayed when the user clicks. But on startup  
I see: `WARN Page '/images/smile.pdf' not found in '_index'`. I tried moving  
the pdf file to `/static/doc`, but this doesn’t fix the issue.

What am I doing wrong? Thanks!

---

<div class="post-metadata">

**Author:** ![anonlyuriew](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/anonlyuriew/32/23682_2.png) [@anonlyuriew](https://discourse.gohugo.io/u/anonlyuriew)\
**Post date:** [January 14, 2025, 6:49am UTC](https://discourse.gohugo.io/t/referencing-a-pdf-works-but-there-is-a-warning-on-startup/53116/2 "2025-01-14T06:49:42Z")

</div>

See this: [Serving pdf files Hugo creates folders with "index.pdf"](https://discourse.gohugo.io/t/serving-pdf-files-hugo-creates-folders-with-index-pdf/1331)

---

<div class="post-metadata">

**Author:** ![Heracles](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/heracles/32/19379_2.png) [@Heracles](https://discourse.gohugo.io/u/Heracles)\
**Post date:** [January 14, 2025, 6:59am UTC](https://discourse.gohugo.io/t/referencing-a-pdf-works-but-there-is-a-warning-on-startup/53116/3 "2025-01-14T06:59:14Z")

</div>

What theme are you using? This seems to be a warning from a [link render hook](https://gohugo.io/render-hooks/links/).

---

<div class="post-metadata">

**Author:** ![djsamperi](https://avatars.discourse-cdn.com/v4/letter/d/e9c0ed/32.png) [@djsamperi](https://discourse.gohugo.io/u/djsamperi)\
**Post date:** [January 14, 2025, 2:13pm UTC](https://discourse.gohugo.io/t/referencing-a-pdf-works-but-there-is-a-warning-on-startup/53116/4 "2025-01-14T14:13:55Z")

</div>

I’m using hugo-book theme.

> **[GitHub - alex-shpak/hugo-book: Hugo documentation theme as simple as plain book](https://github.com/alex-shpak/hugo-book)**
>
> Hugo documentation theme as simple as plain book

---

<div class="post-metadata">

**Author:** ![frjo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/frjo/32/18626_2.png) [@frjo](https://discourse.gohugo.io/u/frjo)\
**Post date:** [January 14, 2025, 2:24pm UTC](https://discourse.gohugo.io/t/referencing-a-pdf-works-but-there-is-a-warning-on-startup/53116/5 "2025-01-14T14:24:29Z")

</div>

The error is from the render-link hook in the theme:

> <https://github.com/alex-shpak/hugo-book/blob/7c78a39c531aa2492ed7e92f2ce9dfb2c8c0d3fa/layouts/_default/_markup/render-link.html#L24>

---

<div class="post-metadata">

**Author:** ![irkode](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/irkode/32/26135_2.png) [@irkode](https://discourse.gohugo.io/u/irkode)\
**Post date:** [January 14, 2025, 2:53pm UTC](https://discourse.gohugo.io/t/referencing-a-pdf-works-but-there-is-a-warning-on-startup/53116/6 "2025-01-14T14:53:21Z")

</div>

looks like there is a param, to disable that  
`{{- if .Page.Site.Params.BookPortableLinks -}}`

- maybe set that to `false` and see if your other markdown links are still working

- if that does not work, you might consider to try [hugos embedded link render hook](https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_default/_markup/render-link.html) by copying the content to `_default/_markup/render-link.html` ([render-hook docs](https://gohugo.io/render-hooks/links/#default))

* * *

without any link render hook and bare markdown.  
if your file is in `/static/doc/smile.pdf` without any render hook it can be referenced as `[smile](/doc/smile.pdf)` in markdown (if your site is in a subfolder as `[smile](/subfolder/doc/smile.pdf)`

---

<div class="post-metadata">

**Author:** ![djsamperi](https://avatars.discourse-cdn.com/v4/letter/d/e9c0ed/32.png) [@djsamperi](https://discourse.gohugo.io/u/djsamperi)\
**Post date:** [January 14, 2025, 6:15pm UTC](https://discourse.gohugo.io/t/referencing-a-pdf-works-but-there-is-a-warning-on-startup/53116/7 "2025-01-14T18:15:39Z")

</div>

Thanks, I’ll have to read more about render hooks.

---

<div class="post-metadata">

**Author:** ![Heracles](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/heracles/32/19379_2.png) [@Heracles](https://discourse.gohugo.io/u/Heracles)\
**Post date:** [January 14, 2025, 6:52pm UTC](https://discourse.gohugo.io/t/referencing-a-pdf-works-but-there-is-a-warning-on-startup/53116/8 "2025-01-14T18:52:06Z")

</div>

Just noting that you’re not doing something wrong and you can safely ignore the warning since everything works as expected. The theme’s author could arguably check if the files / resources exist with a better method.
