Skip to content

Commit ac8662c

Browse files
committed
Add book opengraph metadata
1 parent 8f8ee53 commit ac8662c

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

book/book.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[book]
2-
title = "CXX"
2+
#title = "Rust ♡ C++"
33
authors = ["David Tolnay"]
4-
description = "Guide for the `cxx` crate, a safe approach to FFI between Rust and C++."
4+
description = "CXX — safe interop between Rust and C++"
55

66
[rust]
77
edition = "2018"

book/build.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ https://github.com/dtolnay/cxx\
1414
</a>\
1515
</li>`;
1616

17+
const opengraph = `\
18+
<meta property="og:image" content="https://cxx.rs/cxx.png" />\
19+
<meta property="og:site_name" content="CXX" />\
20+
<meta property="og:title" content="CXX — safe interop between Rust and C++" />\
21+
<meta name="twitter:image:src" content="https://cxx.rs/cxx.png" />\
22+
<meta name="twitter:site" content="@davidtolnay" />\
23+
<meta name="twitter:card" content="summary" />\
24+
<meta name="twitter:title" content="CXX — safe interop between Rust and C++" />`;
25+
1726
const htmljs = `\
1827
var html = document.querySelector('html');
1928
html.classList.remove('no-js');
@@ -37,6 +46,7 @@ while (dirs.length) {
3746
const index = fs.readFileSync(path, 'utf8');
3847
const $ = cheerio.load(index, { decodeEntities: false });
3948

49+
$('head').append(opengraph);
4050
$('script:nth-of-type(3)').text(htmljs);
4151
$('nav#sidebar ol.chapter').append(githublink);
4252
$('head link[href="tomorrow-night.css"]').attr('disabled', true);

book/src/cxx.png

63 KB
Loading

0 commit comments

Comments
 (0)