Skip to content

Commit b3f11ba

Browse files
committed
fix #969 (comment): support full URLs in cover-image
1 parent 7203154 commit b3f11ba

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: bookdown
22
Type: Package
33
Title: Authoring Books and Technical Documents with R Markdown
4-
Version: 0.22.13
4+
Version: 0.22.14
55
Authors@R: c(
66
person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")),
77
person("JJ", "Allaire", role = "ctb"),

R/html.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,12 @@ clean_meta_tags = function(x) {
490490
x3 = sub(r, '\\3', x[i])
491491
x2 = gsub('<[^>]+>', '', x2)
492492
x[i] = paste0(x1, x2, x3)
493+
# then fix URLs in meta: https://github.com/rstudio/bookdown/pull/969#issuecomment-885252698
494+
r = '^(\\s*<meta (property="og:image"|name="twitter:image") content=")[^"]*?/(https?://[^"]+" />\\s*)$'
495+
x = gsub(r, '\\1\\3', x)
496+
# remove the unnecessary extra slash introduced in #969
497+
r = '^(\\s*<meta (property="og:image"|name="twitter:image") content="https?://[^"]+?/)/([^"]+" />\\s*)$'
498+
x = gsub(r, '\\1\\3', x)
493499
x
494500
}
495501

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy