Getting Started

Quick Start

library(qrtdown)

# Initialize qrtdown in your package
use_qrtdown()

# Build the site
build_site()

# Preview in browser
preview_site()

Coming from pkgdown?

qrtdown handles articles differently than pkgdown. Here’s what you need to know:

pkgdown qrtdown
Article location vignettes/ vignettes/articles/
File format .Rmd .qmd (or .Rmd, .md)
R CMD check Vignettes are built Articles are ignored
Config Manual in _pkgdown.yml Auto-discovered

Migration Steps

  1. Create the articles directory:

    dir.create("vignettes/articles", recursive = TRUE)
  2. Move your vignettes:

    # Move all .Rmd files to articles/
    fs::file_move(
      fs::dir_ls("vignettes", glob = "*.Rmd"),
      "vignettes/articles/"
    )
  3. Convert to .qmd (optional but recommended):

    # Rename .Rmd to .qmd
    for (f in fs::dir_ls("vignettes/articles", glob = "*.Rmd")) {
      fs::file_move(f, fs::path_ext_set(f, "qmd"))
    }
  4. Remove vignette engine headers:

    pkgdown vignettes have engine metadata that qrtdown articles don’t need:

    # REMOVE this from your articles:
    vignette: >
      %\VignetteIndexEntry{Title}
      %\VignetteEngine{knitr::rmarkdown}
  5. Build:

    use_qrtdown()
    build_site()

Why vignettes/articles/?

R treats files in vignettes/ as package vignettes. During R CMD check, R tries to build them, which can cause issues:

  • Vignettes need special YAML headers
  • Build failures block package submission to CRAN
  • Long-running examples slow down checks

By placing website content in vignettes/articles/, qrtdown keeps your documentation separate from R’s vignette system. The articles/ subdirectory is ignored by R but rendered by qrtdown.

Important: If you put .qmd files directly in vignettes/ (not in the articles/ subdirectory), qrtdown will not find them.

Creating Articles

The “Get started” Article

Create the main introductory article for your package:

use_qrtdown_getting_started()

This creates vignettes/articles/{packagename}.qmd and adds a separate “Get started” tab in the navbar (not in the Articles dropdown). This follows the pkgdown convention.

Regular Articles

For additional articles that appear in the Articles dropdown:

use_qrtdown_article("my-article", title = "My Article Title")

This creates vignettes/articles/my-article.qmd with proper YAML front matter.

Linking to Articles

How qrtdown Handles Your README

By default, qrtdown generates index.qmd which includes your README content:

your-package/
├── README.qmd           # Your source file (optional)
├── README.md            # Rendered from README.qmd by build_site()
└── index.qmd            # Generated: includes README.md + adds sidebar

The generated index.qmd looks like:

---
title: mypackage
---

::: {.column-margin}
### Links
- [Source Code](...)
### Citation
[Citing this package](citation.qmd)
:::

{{< include README.md >}}

Your README stays untouched, and qrtdown adds the sidebar with package metadata.

Configuration

Minimal Setup

After running use_qrtdown(), you get a _qrtdown.yml:

url: https://github.com/yourname/yourpackage
template:
  theme: cosmo

That’s often all you need. qrtdown auto-discovers:

  • Articles in vignettes/articles/
  • Citation from inst/CITATION
  • Changelog from NEWS.md
  • Logo from man/figures/logo.png

Common Customizations

Change theme:

template:
  theme: flatly

Add external links:

navbar:
  right:
  - icon: globe
    href: https://yoursite.com
    aria-label: Website

What NOT to Do

Don’t manually list articles with explicit paths:

# DON'T do this - paths won't work as expected
navbar:
  left:
  - text: Articles
    menu:
    - text: Guide
      href: vignettes/guide.qmd  # Wrong! Should be vignettes/articles/

Instead, just indicate Articles should exist:

# DO this - qrtdown fills in the menu automatically
navbar:
  left:
  - text: Articles

qrtdown scans vignettes/articles/ and builds the dropdown menu for you.

Images and Static Assets

qrtdown automatically copies images to your built site. Here’s where to store them.

Where to Put Images

Location Use Case How to Reference
man/figures/ Logo and README images ![](man/figures/image.png)
vignettes/articles/images/ Article images ![](images/image.png)

README Images

For images in your README, use man/figures/:

your-package/
├── README.md
└── man/
    └── figures/
        ├── logo.png
        └── screenshot.png

Reference in README.md:

![Screenshot](man/figures/screenshot.png)

Article Images

For images in articles, create an images/ folder inside vignettes/articles/:

vignettes/articles/
├── getting-started.qmd
├── advanced-usage.qmd
└── images/
    ├── diagram.png
    ├── screenshot.png
    └── workflow.png

Reference in any article:

![](images/diagram.png)

How It Works

qrtdown configures Quarto to copy these directories to your output:

  • man/figures/** - All package figures
  • vignettes/articles/** - All article subdirectories (including images/)

This happens automatically when you run build_site().

Troubleshooting

Articles not appearing?

  1. Check location: Files must be in vignettes/articles/, not vignettes/
  2. Check extension: Must be .qmd, .Rmd, or .md
  3. Check for underscore: Files starting with _ are ignored (they’re partials)
  4. Rebuild: Run build_site() to regenerate the navbar

Site looks different when running quarto render directly?

Always use build_site(). It regenerates _quarto.yml with current content. Running quarto render directly may use stale configuration.

Run diagnostics

qrtdown_sitrep()

This shows: - Quarto version and path - What content was detected - What pages will be generated - Navbar structure

Checking the Build Came Out Right

qrtdown_sitrep() checks your setup before a build, and the Troubleshooting section above covers builds that fail. Neither catches the more awkward case: a build that reports success and produces a broken site.

That case is real. Two defects shipped this way — reference pages that served .qmd downloads instead of HTML, and a home page rendered as markdown with an index.html that was only a redirect stub. Both printed a clean build log.

qrtdown ships a script that inspects docs/ after a build:

Rscript inst/scripts/check-site.R              # in your package root

Or against another package:

Rscript $(Rscript -e 'cat(system.file("scripts/check-site.R", package = "qrtdown"))') ~/R/mypkg

It reports one line per check and exits non-zero on failure, so it works as a CI step:

qrtdown site check — mypkg 1.2.0
  ok    home page renders as HTML
  ok    home page has exactly one <h1>
  ok    no stray .md/.qmd in docs/
  ok    all 12 Rd topics rendered to HTML
  ok    no reference page looks truncated
  ok    version matches DESCRIPTION
  ok    citation page carries all 3 CITATION fields
  ok    all 104 internal links resolve

all checks passed

What each check is for:

Check Catches
Home page is HTML, not a redirect stub An included README.qmd whose format: overrode the site’s
Exactly one <h1> A README heading duplicating the generated page title
No stray .md/.qmd in docs/ Pages rendered to the wrong format, or copied verbatim instead of rendered
Every man/*.Rd has a .html page Reference pages generated but never rendered
No reference page looks truncated Rd conversion falling back and dropping Arguments, Value and Examples
Version matches DESCRIPTION A stale navbar from a cached _quarto.yml
Citation fields survive meta-dependent fields, such as the version, silently dropped
Internal links resolve Renamed or removed pages leaving dead links behind

The citation check renders your inst/CITATION the way R does and asserts each field reaches the page. It deliberately ignores the navbar and footer, which carry the version on every page — grepping the whole page for the version passes even when the citation entry has lost it.

Deploying Your Site

qrtdown supports automatic deployment via CI (recommended) or manual deployment.

How Automatic Deployment Works

The use_qrtdown_*_pages() functions create CI workflow files. They do not deploy your site directly. Instead:

  1. You run the setup function once (creates the workflow file)
  2. You commit and push the workflow file to your repository
  3. You enable CI in your repository settings
  4. From then on: Every push to main automatically rebuilds and deploys your site

You never need to manually build or deploy again - just push your code.

GitHub Pages

use_qrtdown_github_pages()

What it does: Creates .github/workflows/qrtdown.yaml

One-time setup after running:

  1. Commit and push the workflow file to GitHub
  2. Go to repository Settings > Pages
  3. Set Source to “GitHub Actions”
  4. Done! Future pushes to main auto-deploy

Codeberg Pages

Codeberg Pages serves static content directly from a pages branch - no CI is required:

# Build and deploy
build_site()
deploy_site()

One-time setup after first deploy:

  1. Go to repository Settings > Pages
  2. Set branch to pages
  3. Your site will be at https://<username>.codeberg.page/<repo>/

Manual Deployment

If you prefer to control when the site updates (or don’t want CI):

# Build locally
build_site()

# Push docs/ to the pages branch
deploy_site(branch = "pages")

Run these commands each time you want to update your site.

deploy_site() replaces the pages branch with a single commit holding the current contents of docs/, so the branch keeps no history. It only reports success after checking that the remote branch points at the new commit, and any git error stops the deploy with git’s own message.

Next Steps

  • Configuration Guide - Detailed configuration options
  • ?build_site - Function documentation
  • ?use_qrtdown_article - Creating articles programmatically