Hugo: Weird handling of pdfs

Created on 17 Jun 2015  路  10Comments  路  Source: gohugoio/hugo

For every pdf that is linked to, Hugo generates a folder with the same name as the pdf and a 2kb file called "index.pdf"

Steps to reproduce:

  1. hugo new site test
  2. hugo new post/sample.md
  3. Edit sample.md to link to /static/Publications/sample.pdf
  4. clone a theme
  5. hugo server --theme=hyde --buildDrafts
  6. Result: /public/Publications/sample/index.pdf

Most helpful comment

All 10 comments

what do you mean "link to"?

Sorry, should have been more explicit about that. Here's "sample.md":

+++
date = "2015-06-17T11:27:24-07:00"
draft = true
title = "sample"
url = "/Publications/sample.pdf"

+++

Ahh. That explains it all.

You don't need the markdown file at all. Just place the pdf file in the /static dir and it will just work.

But what if I want to have, for instance, a post with an abstract of the paper and link to it?

Something like:

+++
date = "2015-06-17T11:27:24-07:00"
draft = true
title = "sample"
url = "/Publications/sample.pdf"

+++

Abstract: blah

you just make a link in the body of the markdown. URL is a special field that means that this content file should reside at that URL destination.

Gotcha! What if I want the title of the post to be the link to the paper?

HTML doesn't support a link in the title tag. If you mean a headline, then you can add an additional field (a non reserved one) in the markdown. Something like "pdf_link" and use that in your template.

This is what I mean: http://comesana.arizona.edu/publications/
Is it possible to make it look like that without generating the index.pdf?
I got the structure form the wordpress to hugo migrator, by the way:https://github.com/SchumacherFM/wordpress-to-hugo-exporter

Nevermind: I used the recommended method.

Was this page helpful?
0 / 5 - 0 ratings