Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/changelog-1.9.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ All changes included in 1.9:

- ([#13524](https://github.com/quarto-dev/quarto-cli/issues/13524)): Add support for Plausible Analytics via `plausible-analytics` configuration option. Users can either paste their Plausible script snippet directly in YAML or provide a path to a file containing the snippet using `plausible-analytics: { path: _plausible_snippet.html }`.
- ([#13525](https://github.com/quarto-dev/quarto-cli/issues/13525)): Algolia Insights now uses privacy-friendly defaults: `useCookie: false` with random session tokens when cookie consent is not configured. When `cookie-consent: true` is enabled, Algolia scripts are deferred and only use cookies after user grants "tracking" consent, ensuring GDPR compliance.
- ([#13547](https://github.com/quarto-dev/quarto-cli/issues/13547))`cookie-content: { type: express }` is now the default. Previously it was `type: implied`. It now means this will block cookies until the user expressly agrees to allow them (or continue blocking them if the user doesn’t agree).

## `publish`

Expand Down
4 changes: 3 additions & 1 deletion src/project/types/website/website-analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ function cookieConsentConfiguration(
): CookieConsentConfiguration {
return {
siteName: "",
type: type || "implied",
type: type || "express",
style: style || "simple",
palette: palette || "light",
policyUrl,
Expand Down Expand Up @@ -378,6 +378,8 @@ gtag('js', new Date());`);
].join("\n");
}

// configuration for the script are defined in
// https://github.com/termsfeed/termsfeed-cookie-consent-4-0/blob/main/README.md
function cookieConsentScript(
config: CookieConsentConfiguration,
) {
Expand Down
6 changes: 3 additions & 3 deletions src/resources/editor/tools/vs-code.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9522,12 +9522,12 @@ var require_yaml_intelligence_resources = __commonJS({
properties: {
type: {
enum: [
"implied",
"express"
"express",
"implied"
],
description: {
short: "The type of consent that should be requested",
long: "The type of consent that should be requested, using one of these two values:\n\n- `implied` (default): This will notify the user that the site uses cookies and permit them to change preferences, but not block cookies unless the user changes their preferences.\n\n- `express`: This will block cookies until the user expressly agrees to allow them (or continue blocking them if the user doesn\u2019t agree).\n"
long: "The type of consent that should be requested, using one of these two values:\n\n- `express` (default): This will block cookies until the user expressly agrees to allow them (or continue blocking them if the user doesn\u2019t agree).\n\n- `implied`: This will notify the user that the site uses cookies and permit them to change preferences, but not block cookies unless the user changes their preferences.\n"
}
},
style: {
Expand Down

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/resources/editor/tools/yaml/web-worker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2494,12 +2494,12 @@
"properties": {
"type": {
"enum": [
"implied",
"express"
"express",
"implied"
],
"description": {
"short": "The type of consent that should be requested",
"long": "The type of consent that should be requested, using one of these two values:\n\n- `implied` (default): This will notify the user that the site uses cookies and permit them to change preferences, but not block cookies unless the user changes their preferences.\n\n- `express`: This will block cookies until the user expressly agrees to allow them (or continue blocking them if the user doesn’t agree).\n"
"long": "The type of consent that should be requested, using one of these two values:\n\n- `express` (default): This will block cookies until the user expressly agrees to allow them (or continue blocking them if the user doesn’t agree).\n\n- `implied`: This will notify the user that the site uses cookies and permit them to change preferences, but not block cookies unless the user changes their preferences.\n"
}
},
"style": {
Expand Down
7 changes: 4 additions & 3 deletions src/resources/schema/definitions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -845,15 +845,16 @@
- object:
properties:
type:
enum: [implied, express]
enum: [express, implied]
description:
short: "The type of consent that should be requested"
long: |
The type of consent that should be requested, using one of these two values:

- `implied` (default): This will notify the user that the site uses cookies and permit them to change preferences, but not block cookies unless the user changes their preferences.
- `express` (default): This will block cookies until the user expressly agrees to allow them (or continue blocking them if the user doesn’t agree).

- `implied`: This will notify the user that the site uses cookies and permit them to change preferences, but not block cookies unless the user changes their preferences.

- `express`: This will block cookies until the user expressly agrees to allow them (or continue blocking them if the user doesn’t agree).
style:
enum: [simple, headline, interstitial, standalone]
description:
Expand Down
4 changes: 2 additions & 2 deletions src/resources/schema/json-schemas.json
Original file line number Diff line number Diff line change
Expand Up @@ -891,8 +891,8 @@
"properties": {
"type": {
"enum": [
"implied",
"express"
"express",
"implied"
]
},
"style": {
Expand Down
8 changes: 4 additions & 4 deletions src/resources/types/schema-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,12 +431,12 @@ For more information, see <https://plausible.io/docs/plausible-script> */;

- `standalone`: An opaque overlay of the entire website. */;
type?:
| "implied"
| "express"; /* The type of consent that should be requested, using one of these two values:
| "express"
| "implied"; /* The type of consent that should be requested, using one of these two values:

- `implied` (default): This will notify the user that the site uses cookies and permit them to change preferences, but not block cookies unless the user changes their preferences.
- `express` (default): This will block cookies until the user expressly agrees to allow them (or continue blocking them if the user doesn’t agree).

- `express`: This will block cookies until the user expressly agrees to allow them (or continue blocking them if the user doesn’t agree). */
- `implied`: This will notify the user that the site uses cookies and permit them to change preferences, but not block cookies unless the user changes their preferences. */
} /* Quarto includes the ability to request cookie consent before enabling scripts that set cookies, using [Cookie Consent](https://www.cookieconsent.com/).

The user’s cookie preferences will automatically control Google Analytics (if enabled) and can be used to control custom scripts you add as well. For more information see [Custom Scripts and Cookie Consent](https://quarto.org/docs/websites/website-tools.html#custom-scripts-and-cookie-consent). */;
Expand Down
4 changes: 2 additions & 2 deletions src/resources/types/zod/schema-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export const ZodBaseWebsite = z.object({
z.enum(["express", "implied"] as const),
z.boolean(),
z.object({
type: z.enum(["implied", "express"] as const),
type: z.enum(["express", "implied"] as const),
style: z.enum(
["simple", "headline", "interstitial", "standalone"] as const,
),
Expand Down Expand Up @@ -506,7 +506,7 @@ export const ZodBookSchema = z.object({
z.enum(["express", "implied"] as const),
z.boolean(),
z.object({
type: z.enum(["implied", "express"] as const),
type: z.enum(["express", "implied"] as const),
style: z.enum(
["simple", "headline", "interstitial", "standalone"] as const,
),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.quarto/
**/*.quarto_ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
project:
type: website

website:
title: "Algolia With Cookie Consent Test"
search:
algolia:
application-id: "TEST_APP_ID"
search-only-api-key: "TEST_API_KEY"
index-name: "test-index"
analytics-events: true
cookie-consent:
type: implied

format:
html:
theme: cosmo
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: "Algolia Search With Cookie Consent"
_quarto:
tests:
html:
ensureHtmlElements:
-
# Ensure search options script exists
- 'script#quarto-search-options'
# Cookie consent element are loaded
- script[src$='cookie-consent.js']
ensureFileRegexMatches:
-
# Cookie consent should be enabled
- '"cookie-consent-enabled":\s*true'
# Scripts should be deferred with cookie-consent attribute
- 'type="text/plain"[^>]*cookie-consent="tracking"[^>]*>[\s\S]*search-insights'
# type should be implied per config
- 'cookieconsent.run\(\{[^}]*"consent_type":"implied"'
---

This test verifies that when `cookie-consent` is configured in the website settings:

1. The Algolia search options JSON contains `"cookie-consent-enabled": true`
2. Algolia Insights scripts are deferred with `type="text/plain" cookie-consent="tracking"`
3. Scripts only execute after user grants "tracking" consent
4. Cookie consent UI elements are present on the page
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ _quarto:
- '"cookie-consent-enabled":\s*true'
# Scripts should be deferred with cookie-consent attribute
- 'type="text/plain"[^>]*cookie-consent="tracking"[^>]*>[\s\S]*search-insights'
# Default type should be express
- 'cookieconsent.run\(\{[^}]*"consent_type":"express"'
---

This test verifies that when `cookie-consent` is configured in the website settings:
Expand Down
Loading