Shared theme for Posit product documentation
First, install the extension:
quarto add posit-dev/product-doc-themeNext, update your project type and format in _quarto.yml:
project:
title: Posit Documentation
type: posit-docsThe following entries may be unique to each product. Please review the following and make manual updates to your project, as required.
For existing sites
If you have website.navbar.right entries in your _quarto.yml, you may have to merge the following with the existing entries in your _quarto.yml.
website:
navbar:
right:
- text: Help
menu:
- text: Return to Posit Docs
href: https://docs.posit.co
- text: Posit Support
href: https://support.posit.co/hc/en-us/requests/newOnce merged, you should manually disable these entries by commenting them out in the _extension.yml.
This should be avoided, if possible.
The extension sets a default navbar logo (posit-icon-fullcolor.svg).
Products with a product-specific logos should override this in _quarto.yml.
Applies to: Workbench, Connect, Package Manager, Chronicle, Connect Cloud, Posit AI
website:
navbar:
logo: images/your-product-mark.svg
logo-alt: Your Product documentationThe extension does not set a height for the navbar logo. Add the following to your site stylesheet so the logo renders at a consistent size:
.navbar-brand-logo .navbar-logo {
height: 28px;
max-height: 28px;
}These sites with product logos should not include the "Posit" prefix in their website title.
In your _quarto.yml:
project:
title: Connect DocumentationNot:
project:
title: Posit Connect DocumentationThe extension does not define a footer. Use the following website.page-footer in your _quarto.yml:
website:
page-footer:
left:
- text: <img src="/images/posit-logos-2024_horiz-full-color.svg" alt="Posit" width="65px" class="light-content posit-footer-logo"><img src="/images/posit-logo-fullcolor-TM.svg" alt="Posit" width="65px" class="dark-content posit-footer-logo">
href: "https://posit.co"
- Copyright © 2000-{{< env CURRENT_YEAR >}} Posit Software, PBC. All Rights Reserved.
center: |
Posit PRODUCT {{< env PRODUCT_VERSION >}}
right:
- text: '<a href="#" id="open_preferences_center" title="Update cookie preferences">
<img src="/images/cookie.svg" alt="Cookie Preferences" class="light-content" style="width: 1em; height: 1em;">
<img src="/images/cookie-copy.svg" alt="Cookie Preferences" class="dark-content" style="width: 1em; height: 1em;">
</a>'
aria-label: 'Cookie Prefs'
- text: Support
aria-label: 'Link to Posit Support'
href: "https://support.posit.co/hc/en-us/requests/new"
- text: Posit Docs
aria-label: 'Link to Posit Docs'
href: "https://docs.posit.co"
Make the following modifications:
-
Product name: Replace the
PRODUCTplaceholder with the product name. -
Product version: Adapt the
PRODUCT_VERSIONvariable for your product based on how that information is made available. The example project gets a default environment variable value from the_environmentfile.You may need to dynamically define
PRODUCT_VERSIONbefore rendering your documentation.export PRODUCT_VERSION=$(cat version.txt)
-
Copyright: Copyright dates are represented as a range from the year of first product release until now. Adapt the
CURRENT_YEARvariable for your product and how that information is made available. The example project gets a default environment variable value from the_environmentfile.You may need to dynamically define
CURRENT_YEARbefore rendering your documentation.export CURRENT_YEAR=$(date "+%Y")
-
Images: Copy the four images from the extension into your project and update the
srcpaths.For example, you may have a top-level
imagesdirectory:cp _extensions/posit-dev/posit-docs/assets/images/cookie.svg images cp _extensions/posit-dev/posit-docs/assets/images/cookie-copy.svg images cp _extensions/posit-dev/posit-docs/assets/images/posit-logo-fullcolor-TM.svg images cp _extensions/posit-dev/posit-docs/assets/images/posit-logos-2024_horiz-full-color.svg images
These images are also available from GitHub.
Our version toast displays the current product version and provides a link to the latest release of the documentation.
This toast should be modified and added to your product documentation.
The _version-toast.html is included in the theme directory and can be copied to your project.
Enable the toast by adding the following to your _quarto.yml:
format:
html:
include-in-header:
- _version-toast.htmlThe extension adds a page actions bar below the title of each page. The bar shows only on pages that have a title block. The bar has two buttons:
- Copy for LLM: Copies the Markdown of the page to the clipboard, with the page URL at the top.
- View as Markdown: Opens the Markdown of the page in a new browser tab.
The buttons use the Markdown copy of each page that Quarto makes when you enable llms-txt.
This feature requires Quarto 1.9 or later, or Quarto 2.
To enable it, add the following to your _quarto.yml:
website:
llms-txt: trueIf a page has no Markdown copy, Copy for LLM copies the text of the rendered page. For the same page, View as Markdown opens a page that shows a 404 (not found) error.
To remove the bar from a page, add the following to the front matter of the page:
body-classes: no-llms-txtIf the page already has body-classes, add no-llms-txt to the list, separated by a space.
Some projects have their own older copy of _page-actions.html.
The extension removes the bar from this copy and shows its own bar.
The copy still adds code to each page, and changes to the copy do not show on the site.
To remove the copy:
- Remove the
_page-actions.htmlfile from your project. - Remove the
_page-actions.htmlentry fromformat.html.include-in-headerin your_quarto.yml.
Do not copy _page-actions.html from the extension into your project.
The styles in a copy load after the styles of the extension.
As a result, the copy can override later style fixes to the extension, for example accessibility fixes.
The extension lives in _extensions/posit-docs.
The example directory holds a sample site that exercises the theme; its _extensions entry is a symlink back to the extension source, so a render there picks up your edits.
To preview your changes against the sample site:
cd example
quarto previewEvery pull request renders the sample site and publishes it to this repository's GitHub Pages site under /pr-preview/pr-<number>/.
A bot comment on the pull request links to it.
The preview is removed when the pull request closes.
Pages serves the gh-pages branch, which the pr-preview action writes to.
Record your changes in the Unreleased section at the top of changelog.md as part of the pull request that makes them, adding the section if it is not there.
Writing the entry alongside the change is easier than reconstructing it from the commit log at release time, and it leaves the release with only a heading to rename.
To release a new version of this theme:
-
Make sure that the extension declares the target version and documents its changes.
- Update
_extensions/posit-docs/_extension.yml; the extension declares its version. - Update
changelog.md; make sure recent changes are announced.
Commit and merge both changes to
main. - Update
-
Tag the target commit and push the tag.
git tag -a v1.1.0 -m 'Release 1.1.0' git push origin v1.1.0 -
Create a GitHub release from that tag.