Skip to content

Commit 2a36694

Browse files
committed
fix: fixup breaking changes for book compilation
1 parent 4e417c3 commit 2a36694

3 files changed

Lines changed: 257 additions & 305 deletions

File tree

book.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,18 @@ after = ["links"]
1616
edition = "2021"
1717

1818
[output.html]
19+
smart-punctuation = true
1920
default-theme = "rust"
2021
site-url = "/patterns/"
2122
git-repository-url = "https://github.com/rust-unofficial/patterns"
22-
git-repository-icon = "fa-github"
2323
edit-url-template = "https://github.com/rust-unofficial/patterns/edit/main/{path}"
2424
additional-css = [
2525
"./theme/css/language-picker.css",
2626
"./styles/last-changed.css",
2727
]
2828

2929
[preprocessor.last-changed]
30+
optional = true
3031
command = "mdbook-last-changed"
3132
renderer = ["html"]
3233

theme/head.hbs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
{{! Move to template code after fixing this issue:
2-
https://github.com/google/mdbook-i18n-helpers/issues/70 }}
2+
https://github.com/google/mdbook-i18n-helpers/issues/70 }}
33
<script>
4-
(function () {
5-
// See these pages for details:
6-
// https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls
7-
// https://developers.google.com/search/docs/crawling-indexing/javascript/javascript-seo-basics
8-
let base = "https://rust-unofficial.github.io/patterns";
9-
{{#if(eq language "en")}}
10-
let canonical_href = `${base}/{{ path }}`;
11-
{{else}}
12-
let canonical_href = `${base}/{{ language }}/{{ path }}`;
13-
{{/if}}
4+
(function () {
5+
// See these pages for details:
6+
// https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls
7+
// https://developers.google.com/search/docs/crawling-indexing/javascript/javascript-seo-basics
8+
let base = "https://rust-unofficial.github.io/patterns";
9+
{{#if (eq language "en")}}
10+
let canonical_href = `${base}/{{ path }}`;
11+
{{else}}
12+
let canonical_href = `${base}/{{ language }}/{{ path }}`;
13+
{{/if}}
1414
15-
// mdbook gives us a string ending in ".md", we replace it with ".html":
16-
canonical_href = canonical_href.slice(0, -"md".length) + "html";
17-
if (canonical_href.endsWith("/index.html")) {
18-
canonical_href = canonical_href.slice(0, -"index.html".length);
19-
}
15+
// mdbook gives us a string ending in ".md", we replace it with ".html":
16+
canonical_href = canonical_href.slice(0, -"md".length) + "html";
17+
if (canonical_href.endsWith("/index.html")) {
18+
canonical_href = canonical_href.slice(0, -"index.html".length);
19+
}
2020
21-
let link = document.createElement("link");
22-
link.rel = "canonical";
23-
link.href = canonical_href;
24-
document.head.appendChild(link);
25-
}) ()
26-
</script>
21+
let link = document.createElement("link");
22+
link.rel = "canonical";
23+
link.href = canonical_href;
24+
document.head.appendChild(link);
25+
})()
26+
</script>

0 commit comments

Comments
 (0)