-
DescriptionI have a Quarto blog that I publish via GitHub and Netlify. A version of the repo on my Linux cloud server runs a cron job that updates events listings daily, pushes to GitHub, and publishes. I use another version of the repo on my local machine to write and publish my blog posts, pulling from the repo first to make sure all my _site files like the site map and search are up to date. The problem comes if I want to work on a post locally that I want to render/preview but not publish for a few days, such as my "Election Results" with fake data I don't want to publish until next week with real data. Even if I set Any suggestions on how to handle this? Is there something else I can do to keep my rendering of a draft post from changing files in my _site directory? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
|
This is more of a Git question than Quarto. Regarding draft, the behaviour is as expected/documented (https://quarto.org/docs/websites/website-drafts.html). There are many ways you can "solve" your issue git fetch
git pull
git checkout --ours _site/
git add _site/
git commitor set a # 1. Create .gitattributes file
echo "_site/* merge=ours" >> .gitattributes
# 2. Define the merge strategy
git config merge.ours.driver true
# 3. Commit the .gitattributes file
git add .gitattributes
git commit -m "Set merge strategy for _site directory"I must admit I did not understand your workflow, especially why you would want to commit/push |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the response. Do you know what happens if I want to work on my Election Results post over several weeks while also adding additional posts? This is a very common workflow for a website that publishes both features and timely news. What if it's Monday and I work on my Election Results draft, tweak it, render locally, and _site files change? Then it's Tuesday and I post a short item by working on it locally, rendering, _site files change again, and I pushing to git remote? Will quarto know not to include the draft _site content in ANY of the _site files and only the live content for things like search results, RSS, sitemap? |
Beta Was this translation helpful? Give feedback.
-
|
Thank you. |
Beta Was this translation helpful? Give feedback.
I see, then you would need some automatic update which starts to get a bit tricky.
Note that the conflict resolution approach I mentioned can target whatever you want, in the example I showed the top-level _site, but you can target any sub-directory or files.
Another approach would be to use render-target to fully exclude rendering of some of your posts or use
_prefix for your draft.