Skip to content

Commit d433605

Browse files
authored
Merge pull request #13770 from mcanouil/fix/issue13769
2 parents 87f18c8 + 4c20945 commit d433605

4 files changed

Lines changed: 54 additions & 2 deletions

File tree

news/changelog-1.9.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ All changes included in 1.9:
5858
- ([#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.
5959
- ([#13716](https://github.com/quarto-dev/quarto-cli/issues/13716)): Fix draft pages showing blank during preview when pre-render scripts are configured.
6060

61+
### `book`
62+
63+
- ([#13769](https://github.com/quarto-dev/quarto-cli/issues/13769)): Apply `repo-link-target` and `repo-link-rel` options to tools in book sidebar for consistent link attribute handling with website projects. (author: @mcanouil)
64+
6165
### `manuscript`
6266

6367
- ([#10031](https://github.com/quarto-dev/quarto-cli/issues/10031)): Fix manuscript rendering prompting for GitHub credentials when origin points to private repository. Auto-detection of manuscript URL now fails gracefully with a warning instead of blocking renders.

src/project/types/book/book-config.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ import {
8282
import {
8383
repoUrlIcon,
8484
websiteConfigActions,
85+
websiteConfigString,
8586
websiteProjectConfig,
8687
} from "../website/website-config.ts";
8788

@@ -229,11 +230,25 @@ export async function bookProjectConfig(
229230
if (site[kSiteRepoUrl]) {
230231
const repoUrl = siteRepoUrl(site);
231232
const icon = repoUrlIcon(repoUrl);
232-
tools.push({
233+
const tool = {
233234
text: language[kCodeToolsSourceCode] || "Source Code",
234235
icon,
235236
href: repoUrl,
236-
});
237+
} as Record<string, unknown>;
238+
239+
// Apply repo-link-target if configured
240+
const linkTarget = websiteConfigString(kSiteRepoLinkTarget, config);
241+
if (linkTarget) {
242+
tool.target = linkTarget;
243+
}
244+
245+
// Apply repo-link-rel if configured
246+
const linkRel = websiteConfigString(kSiteRepoLinkRel, config);
247+
if (linkRel) {
248+
tool.rel = linkRel;
249+
}
250+
251+
tools.push(tool);
237252
}
238253
tools.push(...(downloadTools(projectDir, config, language) || []));
239254
tools.push(...(sharingTools(config, language) || []));
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
project:
2+
type: book
3+
4+
book:
5+
title: "issue13769"
6+
author: "Norah Jones"
7+
date: "12/10/2025"
8+
repo-url: "https://github.com/quarto-dev/quarto-cli"
9+
repo-link-target: "_blank"
10+
repo-link-rel: "noreferrer"
11+
repo-actions: none
12+
chapters:
13+
- index.qmd
14+
15+
16+
format:
17+
html:
18+
theme:
19+
- cosmo
20+
- brand
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
_quarto:
3+
tests:
4+
html:
5+
ensureHtmlElements:
6+
- ['a[rel="noreferrer"][target="_blank"][href="https://github.com/quarto-dev/quarto-cli"][class~="quarto-navigation-tool"]']
7+
---
8+
9+
# Preface
10+
11+
This is a Quarto book.
12+
13+
To learn more about Quarto books visit <https://quarto.org/docs/books>.

0 commit comments

Comments
 (0)