-
Notifications
You must be signed in to change notification settings - Fork 212
/
build_gh_pages_rayshader.R
34 lines (30 loc) · 1.59 KB
/
build_gh_pages_rayshader.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
pkgdown::build_site(run_dont_run = TRUE, lazy = TRUE)
system('echo "www.rayshader.com" >> docs/CNAME')
system("git checkout -b gh-pages")
library(magrittr)
twitter_card = list()
twitter_card[[1]] = xml2::read_xml("<meta />")
twitter_card[[2]] = xml2::read_xml("<meta />")
twitter_card[[3]] = xml2::read_xml("<meta />")
twitter_card[[4]] = xml2::read_xml("<meta />")
twitter_card[[5]] = xml2::read_xml("<meta />")
xml2::xml_attrs(twitter_card[[1]]) = c(property="twitter:image:src", content="https://www.rayshader.com/reference/figures/website.png")
xml2::xml_attrs(twitter_card[[2]]) = c(name="twitter:site", content="@github")
xml2::xml_attrs(twitter_card[[3]]) = c(name="twitter:card", content="summary_large_image")
xml2::xml_attrs(twitter_card[[4]]) = c(name="twitter:title", content="tylermorganwall/rayshader")
xml2::xml_attrs(twitter_card[[5]]) = c(name="twitter:description", content="R Package for Producing and Visualizing Hillshaded Maps from Elevation Matrices, in 2D and 3D - tylermorganwall/rayshader")
xml2::read_html("docs/index.html") %>%
xml2::xml_find_first("head") %>%
xml2::xml_add_child(twitter_card[[1]]) %>%
xml2::xml_add_sibling(twitter_card[[2]]) %>%
xml2::xml_add_sibling(twitter_card[[3]]) %>%
xml2::xml_add_sibling(twitter_card[[4]]) %>%
xml2::xml_add_sibling(twitter_card[[5]]) %>%
xml2::xml_parent() %>%
xml2::xml_parent() %>%
xml2::write_html("docs/index.html")
system("git add -f docs")
system('git commit -m "deploy to gh-pages"')
system("git push origin `git subtree split --prefix docs`:gh-pages --force")
system("git checkout master")
system("git branch -D gh-pages")