-
DescriptionBackgroundI'm building a website using Quarto with the GoalI want to display the git commit hash of the most recent commit on each page of my website (perhaps in a footer or header), to help track which version of the site is being viewed. Current approachCurrently, I can add this Python snippet to each ``{python}
import subprocess
print(subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode().strip())
`` ProblemManually adding this code to every page is tedious and hard to maintain. QuestionIs there a way to automatically include the git commit hash on every page of a Quarto website without copy-pasting this code into each I'm looking for a solution that:
My Quarto configurationHere's my current project:
title: "pet-dashboard"
type: "website"
render:
- "*.qmd"
website:
title: "Your Pet's Dashboard"
format:
html:
self-contained: true
code-fold: true
code-tools: true
editor:
render-on-save: true
css: styles.css
execute:
freeze: auto I've considered using includes, partials, or other Quarto features but I'm not sure about the best approach. Any help would be appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Use a LUA filter or https://quarto.org/docs/extensions/lua.html Side note: |
Beta Was this translation helpful? Give feedback.
Use a LUA filter or
page-footer
or any parts like that.There is no "best approach". Pick the one that works for you.
https://quarto.org/docs/extensions/lua.html
Side note:
self-contained
is a 2 years old outdated option. Useembed-resources
as documented.