Skip to content

Latest commit

 

History

469 Commits

Folders and files

Repository files navigation

product-doc-theme

Shared theme for Posit product documentation

Usage

First, install the extension:

quarto add posit-dev/product-doc-theme

Next, update your project type and format in _quarto.yml:

project:
  title: Posit Documentation
  type: posit-docs

Additional configuration entries

The following entries may be unique to each product. Please review the following and make manual updates to your project, as required.

Navbar

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/new

Once merged, you should manually disable these entries by commenting them out in the _extension.yml. This should be avoided, if possible.

Product logos

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 documentation

The 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;
}
Sites with product logos: title

These sites with product logos should not include the "Posit" prefix in their website title.

In your _quarto.yml:

project:
  title: Connect Documentation

Not:

project:
  title: Posit Connect Documentation

Footer

The 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 &copy; 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 PRODUCT placeholder with the product name.

  • Product version: Adapt the PRODUCT_VERSION variable for your product based on how that information is made available. The example project gets a default environment variable value from the _environment file.

    You may need to dynamically define PRODUCT_VERSION before 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_YEAR variable for your product and how that information is made available. The example project gets a default environment variable value from the _environment file.

    You may need to dynamically define CURRENT_YEAR before rendering your documentation.

    export CURRENT_YEAR=$(date "+%Y")
  • Images: Copy the four images from the extension into your project and update the src paths.

    For example, you may have a top-level images directory:

    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.

Version toast

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.html

Page actions

The 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: true

If 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-txt

If the page already has body-classes, add no-llms-txt to the list, separated by a space.

Remove a project copy of the page actions

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:

  1. Remove the _page-actions.html file from your project.
  2. Remove the _page-actions.html entry from format.html.include-in-header in 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.

Development

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 preview

Pull request previews

Every 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.

Release

To release a new version of this theme:

  1. Make sure that the extension declares the target version and documents its changes.

    1. Update _extensions/posit-docs/_extension.yml; the extension declares its version.
    2. Update changelog.md; make sure recent changes are announced.

    Commit and merge both changes to main.

  2. 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
  3. Create a GitHub release from that tag.

Additional resources

Releases

Used by

Contributors

Languages