diff --git a/news/changelog-1.11.md b/news/changelog-1.11.md index 9125563e868..066c539bf2e 100644 --- a/news/changelog-1.11.md +++ b/news/changelog-1.11.md @@ -35,6 +35,14 @@ All changes included in 1.11: - ([#14847](https://github.com/quarto-dev/quarto-cli/pull/14847)): Fix `toc_title` auto-fallback in typst outline template that was ignoring the computed fallback value when `toc_title` is `none`. +## Projects + +### Books + +- ([#10114](https://github.com/quarto-dev/quarto-cli/issues/10114)): Support `announcement` under the `book` key, which previously had no effect. +- ([#14276](https://github.com/quarto-dev/quarto-cli/issues/14276)): Support `llms-txt` under the `book` key, which previously had no effect. +- ([#14879](https://github.com/quarto-dev/quarto-cli/issues/14879)): Support `plausible-analytics`, `back-to-top-navigation`, and `image-alt` under the `book` key, which previously had no effect. + ## Commands ### `call` diff --git a/src/project/types/book/book-config.ts b/src/project/types/book/book-config.ts index bb721e9526d..255947ae3a3 100644 --- a/src/project/types/book/book-config.ts +++ b/src/project/types/book/book-config.ts @@ -37,11 +37,15 @@ import { import { kProjectRender, ProjectConfig } from "../../types.ts"; import { + kAnnouncement, + kBackToTopNavigation, kBodyFooter, kBodyHeader, kBreadCrumbNavigation, kContents, kImage, + kImageAlt, + kLlmsTxt, kMarginFooter, kMarginHeader, kOpenGraph, @@ -114,6 +118,7 @@ import { import { kCookieConsent, kGoogleAnalytics, + kPlausibleAnalytics, } from "../website/website-analytics.ts"; import { RenderFlags } from "../../../command/render/types.ts"; import { formatLanguage } from "../../../core/language.ts"; @@ -162,6 +167,7 @@ export async function bookProjectConfig( site[kOpenGraph] = book[kOpenGraph]; site[kTwitterCard] = book[kTwitterCard]; site[kImage] = book[kImage]; + site[kImageAlt] = book[kImageAlt]; site[kMarginHeader] = book[kMarginHeader]; site[kMarginFooter] = book[kMarginFooter]; site[kBodyHeader] = book[kBodyHeader]; @@ -169,7 +175,11 @@ export async function bookProjectConfig( site[kBookSearch] = book[kBookSearch]; site[kSiteReaderMode] = book[kSiteReaderMode]; site[kGoogleAnalytics] = book[kGoogleAnalytics]; + site[kPlausibleAnalytics] = book[kPlausibleAnalytics]; site[kCookieConsent] = book[kCookieConsent]; + site[kAnnouncement] = book[kAnnouncement]; + site[kBackToTopNavigation] = book[kBackToTopNavigation]; + site[kLlmsTxt] = book[kLlmsTxt]; site[kComments] = book[kComments]; site[kBreadCrumbNavigation] = book[kBreadCrumbNavigation]; site[kOtherLinks] = book[kOtherLinks]; diff --git a/tests/docs/smoke-all/book/announcement/.gitignore b/tests/docs/smoke-all/book/announcement/.gitignore new file mode 100644 index 00000000000..1805b039507 --- /dev/null +++ b/tests/docs/smoke-all/book/announcement/.gitignore @@ -0,0 +1,3 @@ +/.quarto/ +/_book/ +**/*.quarto_ipynb diff --git a/tests/docs/smoke-all/book/announcement/_quarto.yml b/tests/docs/smoke-all/book/announcement/_quarto.yml new file mode 100644 index 00000000000..9c02efcb72a --- /dev/null +++ b/tests/docs/smoke-all/book/announcement/_quarto.yml @@ -0,0 +1,14 @@ +project: + type: book + +book: + title: "Announcement Book" + announcement: + content: "Some information you should pay attention to" + type: primary + chapters: + - index.qmd + +format: + html: + theme: cosmo diff --git a/tests/docs/smoke-all/book/announcement/index.qmd b/tests/docs/smoke-all/book/announcement/index.qmd new file mode 100644 index 00000000000..bff7664ad20 --- /dev/null +++ b/tests/docs/smoke-all/book/announcement/index.qmd @@ -0,0 +1,13 @@ +--- +_quarto: + tests: + html: + ensureHtmlElements: + - + - 'div#quarto-announcement.alert-primary div.quarto-announcement-content' +--- + +# Preface {.unnumbered} + +An announcement configured under the `book` key must render the announcement +bar in the book website output. diff --git a/tests/docs/smoke-all/book/back-to-top-navigation/.gitignore b/tests/docs/smoke-all/book/back-to-top-navigation/.gitignore new file mode 100644 index 00000000000..1805b039507 --- /dev/null +++ b/tests/docs/smoke-all/book/back-to-top-navigation/.gitignore @@ -0,0 +1,3 @@ +/.quarto/ +/_book/ +**/*.quarto_ipynb diff --git a/tests/docs/smoke-all/book/back-to-top-navigation/_quarto.yml b/tests/docs/smoke-all/book/back-to-top-navigation/_quarto.yml new file mode 100644 index 00000000000..3696b2d17b0 --- /dev/null +++ b/tests/docs/smoke-all/book/back-to-top-navigation/_quarto.yml @@ -0,0 +1,12 @@ +project: + type: book + +book: + title: "Back To Top Book" + back-to-top-navigation: true + chapters: + - index.qmd + +format: + html: + theme: cosmo diff --git a/tests/docs/smoke-all/book/back-to-top-navigation/index.qmd b/tests/docs/smoke-all/book/back-to-top-navigation/index.qmd new file mode 100644 index 00000000000..f23cff94b63 --- /dev/null +++ b/tests/docs/smoke-all/book/back-to-top-navigation/index.qmd @@ -0,0 +1,13 @@ +--- +_quarto: + tests: + html: + ensureHtmlElements: + - + - 'a#quarto-back-to-top[role="button"]' +--- + +# Preface {.unnumbered} + +`back-to-top-navigation` under the `book` key must add the back to top control +to the book website output. diff --git a/tests/docs/smoke-all/book/image-alt/.gitignore b/tests/docs/smoke-all/book/image-alt/.gitignore new file mode 100644 index 00000000000..1805b039507 --- /dev/null +++ b/tests/docs/smoke-all/book/image-alt/.gitignore @@ -0,0 +1,3 @@ +/.quarto/ +/_book/ +**/*.quarto_ipynb diff --git a/tests/docs/smoke-all/book/image-alt/_quarto.yml b/tests/docs/smoke-all/book/image-alt/_quarto.yml new file mode 100644 index 00000000000..4f5bd8ee46d --- /dev/null +++ b/tests/docs/smoke-all/book/image-alt/_quarto.yml @@ -0,0 +1,16 @@ +project: + type: book + +book: + title: "Image Alt Book" + site-url: "https://example.com" + open-graph: true + twitter-card: true + image: cover.png + image-alt: "A description of the preview image" + chapters: + - index.qmd + +format: + html: + theme: cosmo diff --git a/tests/docs/smoke-all/book/image-alt/cover.png b/tests/docs/smoke-all/book/image-alt/cover.png new file mode 100644 index 00000000000..e1f5bc61d11 Binary files /dev/null and b/tests/docs/smoke-all/book/image-alt/cover.png differ diff --git a/tests/docs/smoke-all/book/image-alt/index.qmd b/tests/docs/smoke-all/book/image-alt/index.qmd new file mode 100644 index 00000000000..0cbcd460c5b --- /dev/null +++ b/tests/docs/smoke-all/book/image-alt/index.qmd @@ -0,0 +1,14 @@ +--- +_quarto: + tests: + html: + ensureHtmlElements: + - + - 'meta[property="og:image:alt"][content="A description of the preview image"]' + - 'meta[name="twitter:image:alt"][content="A description of the preview image"]' +--- + +# Preface {.unnumbered} + +`image-alt` under the `book` key must set the alt text on the social metadata +preview image. diff --git a/tests/docs/smoke-all/book/llms-txt/.gitignore b/tests/docs/smoke-all/book/llms-txt/.gitignore new file mode 100644 index 00000000000..1805b039507 --- /dev/null +++ b/tests/docs/smoke-all/book/llms-txt/.gitignore @@ -0,0 +1,3 @@ +/.quarto/ +/_book/ +**/*.quarto_ipynb diff --git a/tests/docs/smoke-all/book/llms-txt/_quarto.yml b/tests/docs/smoke-all/book/llms-txt/_quarto.yml new file mode 100644 index 00000000000..20c1bb64286 --- /dev/null +++ b/tests/docs/smoke-all/book/llms-txt/_quarto.yml @@ -0,0 +1,13 @@ +project: + type: book + +book: + title: "llms-txt Book" + site-url: "https://example.com" + llms-txt: true + chapters: + - index.qmd + +format: + html: + theme: cosmo diff --git a/tests/docs/smoke-all/book/llms-txt/index.qmd b/tests/docs/smoke-all/book/llms-txt/index.qmd new file mode 100644 index 00000000000..82528270613 --- /dev/null +++ b/tests/docs/smoke-all/book/llms-txt/index.qmd @@ -0,0 +1,16 @@ +--- +_quarto: + render-project: true + tests: + html: + ensureLlmsTxtExists: true + ensureLlmsMdExists: true + ensureLlmsTxtRegexMatches: + - ['^# llms-txt Book', '^## Pages', '\[.*\]\(.*\.llms\.md\)'] + - [] +--- + +# Preface {.unnumbered} + +`llms-txt` set under the `book` key must generate the llms.txt index, the same +way it does under `website`. diff --git a/tests/docs/smoke-all/book/plausible-analytics/.gitignore b/tests/docs/smoke-all/book/plausible-analytics/.gitignore new file mode 100644 index 00000000000..1805b039507 --- /dev/null +++ b/tests/docs/smoke-all/book/plausible-analytics/.gitignore @@ -0,0 +1,3 @@ +/.quarto/ +/_book/ +**/*.quarto_ipynb diff --git a/tests/docs/smoke-all/book/plausible-analytics/_plausible_snippet.html b/tests/docs/smoke-all/book/plausible-analytics/_plausible_snippet.html new file mode 100644 index 00000000000..92af7a8e81f --- /dev/null +++ b/tests/docs/smoke-all/book/plausible-analytics/_plausible_snippet.html @@ -0,0 +1 @@ + diff --git a/tests/docs/smoke-all/book/plausible-analytics/_quarto.yml b/tests/docs/smoke-all/book/plausible-analytics/_quarto.yml new file mode 100644 index 00000000000..704bf271bc3 --- /dev/null +++ b/tests/docs/smoke-all/book/plausible-analytics/_quarto.yml @@ -0,0 +1,13 @@ +project: + type: book + +book: + title: "Plausible Analytics Book" + chapters: + - index.qmd + plausible-analytics: + path: _plausible_snippet.html + +format: + html: + theme: cosmo diff --git a/tests/docs/smoke-all/book/plausible-analytics/index.qmd b/tests/docs/smoke-all/book/plausible-analytics/index.qmd new file mode 100644 index 00000000000..c57e3f1d52d --- /dev/null +++ b/tests/docs/smoke-all/book/plausible-analytics/index.qmd @@ -0,0 +1,13 @@ +--- +_quarto: + tests: + html: + ensureHtmlElements: + - + - 'script[async][src="https://plausible.io/js/pa-BOOKFILE99.js"]' +--- + +# Preface {.unnumbered} + +Plausible Analytics configured under the `book` key must be applied to the +rendered book website, the same way `google-analytics` is. diff --git a/tests/docs/smoke-all/website/llms-txt-drafts/.gitignore b/tests/docs/smoke-all/website/llms-txt-drafts/.gitignore index c96a27a6e40..1252e779970 100644 --- a/tests/docs/smoke-all/website/llms-txt-drafts/.gitignore +++ b/tests/docs/smoke-all/website/llms-txt-drafts/.gitignore @@ -2,6 +2,8 @@ *.html *.llms.md llms.txt +search.json +site_libs/ *_files/ **/*.quarto_ipynb diff --git a/tests/docs/smoke-all/website/llms-txt-listing/.gitignore b/tests/docs/smoke-all/website/llms-txt-listing/.gitignore index c96a27a6e40..1252e779970 100644 --- a/tests/docs/smoke-all/website/llms-txt-listing/.gitignore +++ b/tests/docs/smoke-all/website/llms-txt-listing/.gitignore @@ -2,6 +2,8 @@ *.html *.llms.md llms.txt +search.json +site_libs/ *_files/ **/*.quarto_ipynb