Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Never include code formatting in page title? #1037

Closed
maelle opened this issue May 21, 2019 · 5 comments

Comments

@maelle
Copy link
Contributor

commented May 21, 2019

See the page title of https://r-hub.github.io/rhub/articles/rhub.html Maybe having rhub in the title is a poor choice (I know that in tidyverse style, one wouldn't add markers around the package name :-) ), but I think there could be legitimate use of code formatting in a vignette title. Could the code marks in vignette titles be removed by default?

@hadley

This comment has been minimized.

Copy link
Member

commented Aug 26, 2019

Agreed

@maelle

This comment has been minimized.

Copy link
Contributor Author

commented Aug 28, 2019

I had a look and do not know where best to handle this so I probably can't help much with code.

Currently the pagetitle is passed in

pagetitle = "$title$",

that is then passed as is to the head template, in the end the template passed to rmarkdown::html_document() contains e.g. <title>$title$ • pkgdown</title>. By the way the og:title also contains the formatting but it is ignored by Twitter (not sure about other OpenGraph consumers).

Therefore I would not know whether to

  • change and complement the line quoted above to directly inject the de-formatted vignette title i.e. already use the YAML metadata of the vignette in build_article (whereas at the moment only rmarkdown::html_document() does if I follow correctly); or amend the code somewhere else.
  • change that only for articles or more generally (I'm thinking of random .md at the root that could have any title), to ensure the head template never gets a formatted title/description.

The potential use of the vignette YAML metadata by pkgdown reminds me of #936 .

Thanks for taking my initial suggestion into consideration, and sorry for not implementing it. 😁

@maelle

This comment has been minimized.

Copy link
Contributor Author

commented Aug 28, 2019

Actually, build_article does use the YAML metadata but for something else :-)

pkgdown/R/build-articles.R

Lines 186 to 189 in 5f6ce0c

# Allow users to opt-in to their own template
front <- rmarkdown::yaml_front_matter(input_path)
ext <- purrr::pluck(front, "pkgdown", "extension", .default = "html")
as_is <- isTRUE(purrr::pluck(front, "pkgdown", "as_is"))

@hadley

This comment has been minimized.

Copy link
Member

commented Aug 28, 2019

Yeah, I think we could just read the yaml metadata before generating the default_data, and then maybe just use the unprocessed article title as the page title?

@maelle

This comment has been minimized.

Copy link
Contributor Author

commented Aug 28, 2019

And this only for articles or for random .md too?

@maelle maelle referenced this issue Aug 28, 2019

@hadley hadley added this to the pkgdown 1.4 milestone Aug 29, 2019

@hadley hadley closed this in 6494246 Aug 29, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.