thegetty / quire

A multi-package repository for the Quire multiformat publishing framework
https://quire.getty.edu/
BSD 3-Clause "New" or "Revised" License
92 stars 12 forks source link

Broken download PDF link on publication sites #797

Closed Erin-Cecele closed 1 year ago

Erin-Cecele commented 1 year ago

Discussed in https://github.com/thegetty/quire/discussions/787

Originally posted by **zsofiaj** July 20, 2023 I am trying again to set up the pdf output on our Italian Paintings project, and I followed the instructions on the documentation page (https://quire.getty.edu/docs-v1/multiformat-output/#pdfprint-output), but the download is not working. I ran quire build, then quire pdf, then I resized the pdf and moved it to a new content/_assets/downloads folder. There was no "downloads" folder there in my template. I changed the resource_link information in my content/_data/publication.yaml file to /downloads/my-file-name.pdf. Then I ran quire build again, and pushed my changes to GitHub. The Netlify deploy finished publishing the site without any problems, but the pdf does not download at the link in the menu. Does anyone have any idea why? @geealbers @Erin-Cecele Does it seem like I followed the instructions correctly? I wondered if something might be off since I didn't find a "downloads" folder in the spot where the documentation stated. Here is a link to our preview site (and you already have access to the repository): https://italian-paintings-march2023-updates.netlify.app I also have some questions about styling the pdf and making it a little neater all around, but I'll post those as new topics once I can get the pdf to download. Thank you!
Erin-Cecele commented 1 year ago

@zsofiaj, Thank you for reporting this issue. This also appears to be occurring in our Getty Quire publications. There appears to be a straightforward solution that we are working on now. We will keep you updated!

geealbers commented 1 year ago

This has been fixed with PR #799, and will be released in upcoming Quire 11ty version 1.0.0-rc.13.

In the meantime, to fix the issue in existing projects, open the _plugins/vite/index.js file in your project and add the _assets/downloads directory to the list of copy targets there that start around line 55. So, it looks like this:

plugins: [
  copy({
    targets: [
      { 
        src: 'public/*', 
        dest: outputDir,
      },
      {
        src: path.join(inputDir, '_assets', 'images', '*'),
        dest: path.join(outputDir, '_assets', 'images')
      },
      {
        src: path.join(inputDir, '_assets', 'downloads', '*'),
        dest: path.join(outputDir, '_assets', 'downloads')
      },
      {
        src: path.join(inputDir, '_assets', 'fonts', '*'),
        dest: path.join(outputDir, '_assets', 'fonts')
      }
    ]
  })
]
zsofiaj commented 1 year ago

Thanks so much, @geealbers. I was not able to find a _plugins/vite/index.js file, though. I don't see the "vite" folder in my "_plugins" folder. See attached screenshot. Am I looking in the wrong place?

Screen Shot 2023-07-26 at 4 52 49 PM
zsofiaj commented 1 year ago

@geealbers Actually I found that same text in the .eleventy.js file in the main directory. I added the missing _assets/downloads directory to the list of copy targets there, and that fixed it. Our pdf downloads fine now. Is this an okay way to fix it? And will I need to undo this once the Quire 11ty version 1.0.0-rc.13 has been released?

geealbers commented 1 year ago

@zsofiaj good sleuthing! I wasn't aware of this but I guess sometime between the version you started your project on, and the latest version of Quire, we moved some stuff from .eleventy.js and into vite/index.js. Whenever you go to update your project the next time, as long as you bring in both the _plugins directory and the .eleventy.js along with everything else (which is what you would normally do anyway), the fix will persist and you won't need to do or undo anything.

zsofiaj commented 1 year ago

Great, thank you @geealbers !