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 @@ -54,6 +54,7 @@ All changes included in 1.9:
- ([#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).
- ([#13570](https://github.com/quarto-dev/quarto-cli/pull/13570)): Replace Twitter with Bluesky in default blog template and documentation examples. New blog projects now include Bluesky social links instead of Twitter.
- ([#13716](https://github.com/quarto-dev/quarto-cli/issues/13716)): Fix draft pages showing blank during preview when pre-render scripts are configured.

## `publish`

Expand Down
3 changes: 3 additions & 0 deletions src/project/project-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ export async function projectContext(
return projectFileMetadata(result, file, force);
},
isSingleFile: false,
previewServer: renderOptions?.previewServer,
diskCache: await createProjectCache(join(dir, ".quarto")),
temp,
cleanup: once(() => {
Expand Down Expand Up @@ -447,6 +448,7 @@ export async function projectContext(
},
notebookContext,
isSingleFile: false,
previewServer: renderOptions?.previewServer,
diskCache: await createProjectCache(join(dir, ".quarto")),
temp,
cleanup: once(() => {
Expand Down Expand Up @@ -526,6 +528,7 @@ export async function projectContext(
return projectFileMetadata(context, file, force);
},
isSingleFile: false,
previewServer: renderOptions?.previewServer,
diskCache: await createProjectCache(join(temp.baseDir, ".quarto")),
temp,
cleanup: once(() => {
Expand Down
1 change: 1 addition & 0 deletions src/project/serve/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,7 @@ async function internalPreviewServer(
services,
useFreezer: true,
devServerReload: true,
previewServer: true,
flags: renderFlags,
pandocArgs: renderPandocArgs,
},
Expand Down
14 changes: 0 additions & 14 deletions src/project/serve/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ import { existsSync1 } from "../../core/file.ts";
import { watchForFileChanges } from "../../core/watch.ts";
import { extensionFilesFromDirs } from "../../extension/extension.ts";
import { notebookContext } from "../../render/notebook/notebook-context.ts";
import {
kDraftMode,
kDraftModeVisible,
} from "../types/website/website-constants.ts";

interface WatchChanges {
config: boolean;
Expand Down Expand Up @@ -69,16 +65,6 @@ export function watchProject(
(await projectContext(project.dir, nbContext, renderOptions, false))!;
};

// See if we're in draft mode
if (project.config) {
// If this is a website
if (project.config.website) {
// Switch
(project.config.website as Record<string, unknown>)[kDraftMode] =
kDraftModeVisible;
}
}

// proj dir
const projDir = normalizePath(project.dir);
const projDirHidden = projDir + "/.";
Expand Down
1 change: 1 addition & 0 deletions src/project/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export interface ProjectContext extends Cloneable<ProjectContext> {
environment: () => Promise<ProjectEnvironment>;

isSingleFile: boolean;
previewServer?: boolean;

diskCache: ProjectCache;
temp: TempContext;
Expand Down
12 changes: 11 additions & 1 deletion src/project/types/website/website-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ import { ProjectContext } from "../../types.ts";
import { warning } from "../../../deno_ral/log.ts";
import { dirname, extname, join, relative } from "../../../deno_ral/path.ts";
import { websiteConfigArray, websiteConfigString } from "./website-config.ts";
import { kDraftMode, kDraftModeGone, kDrafts } from "./website-constants.ts";
import {
kDraftMode,
kDraftModeGone,
kDraftModeVisible,
kDrafts,
} from "./website-constants.ts";

export function removeChapterNumber(item: Element) {
const numberSpan = item.querySelector(".chapter-number");
Expand All @@ -39,6 +44,11 @@ export function isProjectDraft(
}

export function projectDraftMode(project: ProjectContext) {
// Preview server always shows drafts
if (project.previewServer) {
return kDraftModeVisible;
}
// Otherwise read from config
const draftMode = websiteConfigString(kDraftMode, project.config);
return draftMode || kDraftModeGone;
}
Expand Down
Loading