rstudio / bookdown

Authoring Books and Technical Documents with R Markdown
https://pkgs.rstudio.com/bookdown/
GNU General Public License v3.0
3.76k stars 1.27k forks source link

Missing metadata in published bs4_book #1080

Closed bwelman closed 3 years ago

bwelman commented 3 years ago

Only "title" and "author" are present as metadata in the published files. I'm missing "description".


By filing an issue to this repo, I promise that

I understand that my issue may be closed if I don't fulfill my promises.

cderv commented 3 years ago

Thanks. description metadata is not currently in the bs4_book html template. That is why it is not used. There is already a PR to add it (among others): https://github.com/rstudio/bookdown/pull/1034

mccarthy-m-g commented 3 years ago

Adding onto this, I was adding some bookdown books to my Zotero library using the Zotero Connector browser plugin and noticed that bs4_books are not recognized as books by Zotero Connector (they're seen as a webpage). Whereas bookdown books using the default theme are recognized as books. I'm assuming this is due to differences in metadata between the two.

For example, compare Hands-On Programming with R which uses the default bookdown theme (recognized as a book, see left icon from the Zotero Connector plugin):

hands-on-programming

To R4DS which uses bs4_book (recognized as a webpage):

r4ds

It would be nice if the behaviour was consistent here between bookdown's different themes (assuming this is a bookdown issue and not a Zotero Connector issue).

cderv commented 3 years ago

@mccarthy-m-g that is interesting. Can you share more documentation about the zotero connector and what are the expected metadata ? thanks.

We'll definitely look into that soon.

mccarthy-m-g commented 3 years ago

@cderv Here is some developer documentation for Zotero Connector. It looks like the plugin uses Zotero Translators to identify whether something is a book, journal, webpage, etc. In this case I'd guess either an "Individual Site Translator" or "Metadata Import" is being used for classification.

I did a quick command-F search through the current list of translators for "gitbook" and "bookdown" but there were no hits. So maybe it is using metadata for classification.

Pinging the main contributor for Zotero Connector, @adomasven, as they might be able to identify the cause of the discrepancy above better than me.

apreshill commented 3 years ago

I think this is related to:

The Zotero Connector may rely on the meta tags to identify books. See: https://www.w3schools.com/tags/tag_meta.asp; https://ogp.me/#types

Screen Shot 2021-03-15 at 9 00 20 PM Screen Shot 2021-03-15 at 9 00 32 PM
cderv commented 3 years ago

We are working on adding metadata for bs4_book but I am still unsure which one are required for zotero connector. We'll add the main one and we'll see after merging is this is working for you or something is still missing.

adomasven commented 3 years ago

I missed the ping from earlier. See exposing metadata for a dev guide on how to provide data that Zotero will understand.

cderv commented 3 years ago

Oh thank you ! 👍

mccarthy-m-g commented 3 years ago

Thanks for working on this! If you ping me after merging I'll check that the zotero metadata is working.

cderv commented 3 years ago

We've now merged the change. Using dev version and setting the correct variable in index.Rmd yaml should result in correct meta tag.

Quick tests show that the zotero connector recognize it as bookdown. However, the content seen will depend of the book.

github-actions[bot] commented 2 years ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.