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
4 changes: 3 additions & 1 deletion src/project/types/website/website-llms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,12 @@ function extractMainContent(doc: Document): string {
}

// Get the main content area
// Note: use querySelector("body") instead of clone.body because
// deno-dom's cloneNode() doesn't preserve the .body convenience getter
const main = clone.querySelector("main") ||
clone.querySelector("#quarto-document-content") ||
clone.querySelector("article") ||
clone.body;
clone.querySelector("body");

if (!main) {
return "";
Expand Down
1 change: 1 addition & 0 deletions tests/docs/smoke-all/website/llms-txt/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ website:
- href: index.qmd
text: Home
- about.qmd
- custom-layout.qmd
sidebar:
contents:
- section: Info
Expand Down
50 changes: 50 additions & 0 deletions tests/docs/smoke-all/website/llms-txt/custom-layout.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
pagetitle: "Custom Layout Page"
page-layout: custom
section-divs: false
toc: false
_quarto:
tests:
html:
ensureLlmsMdExists: true
ensureLlmsMdRegexMatches:
- ["Welcome to the Custom Page", "Feature One", "Feature Two", "Learn more"]
- []
---

::: {.hero-banner}
::: {.content-block}

# Welcome to the Custom Page

### A page using custom layout

- This tests that llms-txt works with page-layout: custom.
- Custom layout pages lack a `<main>` element in the rendered HTML.

:::
:::

::: {.content-block}
::: {.features}

::: {.feature}
### Feature One
Description of the first feature.

::: {.learn-more}
[Learn more »](about.qmd)
:::
:::

::: {.feature}
### Feature Two
Description of the second feature.

::: {.learn-more}
[Learn more »](about.qmd)
:::
:::

:::
:::
Loading