Only display PDF Download Link when PDF is actually available
After merging !15 (merged), we introduce the "Download PDF" button, and create a link based on some naming conventions.
However, there's no linkage between the assembler.yml file and the download button to see what version components actually have PDFs. We need a way to determine this, so that some pages on the site have the download button and others do not.
Option: Site Key
A coarse option is to create a custom "key" that turns these on and off. That works at the site level, which is not quite right -- no way to turn off the PDF download for certain components.
Option: Dynamic Detection
We could hide the button by default, and turn it on dynamically based on the presence of the PDF. We'd need to include some javascript that runs on page load and checks the server for the presence of the link -- by sending an XHR HEAD request to see that the file exists. If it does, display the button; otherwise leave it blank.
On top of the complexity of the extra dynamic call, there's also going to be some visual lag resulting from this. The button will either pop in suddenly a second or so after page load; or will suddenly pop out. We can sidestep this visual jar by always having the button and just enabling/disabling it -- the fade-in once a PDF is determined to exist will be less striking.
Option: Post Antora Processing
We could add steps to the CI pipeline that processes the public/
directory after Antora is done.
It could look for the presence of the PDF file, and then re-write the HTML files (or CSS files) to make the button present or not based on that.
There's some hacky coupling this would have to the Antora output formats; not ideal but would probably work.
Option: Antora Extension
Assuming that the Antora assembler extension doesn't provide any information to the individual page constructions, we could add our own extension that does this.
This could be by editing the existing Antora assembler, or just providing a new one that reads the same assembler.yml
files, but presents the information to the page generation.
This option isn't well thought out, and may not be possible. More research is needed to see if this is feasible.