quarto-dev / quarto-dev/quarto-cli

Variable substitution via shortcodes fails in `icon` and `href` fields of `about` links

Open
#10,289 10 comments 1 reaction 1 assignee View on GitHub

@cscheid is already working on this.

Since Mar 19, 2025.

bug enhancement metadata shortcodes
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

Bug description

Suppose you have an item baz in _variables.yml, which contains named subitems foo and bar. If one uses the shortcode {{<var baz.foo >}} in the links subkey of an about page, such as:

title: About Page
about:
  links:
    - icon: {{<var baz.foo >}}
      href: {{<var baz.bar >}}

No variable substitution is performed.

This relates to #1627, #8987, and #4680.

Thank You!

Steps to reproduce

_variables.yml, in project root:

gh: 
  txt: GitHub
  lnk: https://github.com/
  icn: "github"
    
lnkdn:
  txt: Linkedin
  icn: "linkedin"
  lnk: "https://www.linkedin.com/in/"

about/index.qmd:

---
title: "More About Me"
image: ../imgs/bio-photo-1.jpg
sidebar: false
about:
  id: about-content
  template: trestles
  image-shape: round
  image-width: 250px
  links:
    - icon: github
      text: ""
      href: "{{< var gh.lnk >}}"
    - icon: linkedin
      text: "[]({{< var lnkdn.lnk >}})"
---

:::{#about-content}
<!-- stuff -->
:::

I've tried various flavors of the above links key based on similar issues. I've also tried this using an about.qmd in the root of the project. I am not able to get variable substitution to work as expected.

For completeness, here is a portion of my root _quarto.yml:

project:
  type: website

website:
  title: "Connor T. Wiegand"
  description: ""

  navbar:
    title: "Me"
    left:
      - text: About Me
        href: about/index.qmd

FWIW, adding repo-url: https://github.com/connortwiegand/ and replacing one of the link options with "{{< meta website.repo-url >}}" produces the following:

WARNING (/opt/quarto/share/filters/main.lua:17471) Unknown meta key website.repo-url specified in a metadata Shortcode.
Expected behavior

var shortcodes are substituted with their values from _variables.yml.

Actual behavior

No variable substitution is performed.

Your environment
  • VSCode 1.91.1
  • Linux Mint 21.3 (Ubuntu 22.04 -- Jammy)
Quarto check output
Quarto 1.5.52
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.2.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.41.0: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.5.52
      Path: /opt/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: (external install)
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /home/cwiegand/.TinyTeX/bin/x86_64-linux
      Version: 2024

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.11.6 (Conda)
      Path: /home/cwiegand/miniconda3/bin/python
      Jupyter: 5.7.2
      Kernels: python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.4.1
      Path: /usr/lib/R
      LibPaths:
        - /home/cwiegand/R/x86_64-pc-linux-gnu-library/4.4
        - /usr/local/lib/R/site-library
        - /usr/lib/R/site-library
        - /usr/lib/R/library
      knitr: 1.48
      rmarkdown: 2.27

[✓] Checking Knitr engine render......OK

EDIT:

Variable substitution does work inside the text key. But not inside the icon or href keys. So this correctly injects a variable:

about:
  links
    - icon: github
      text: "{{< var gh.text >}}"

While both of these fail:

about:
  links
    - icon:  "{{< var gh.icon >}}"
      href: "{{< var gh.link >}}"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.