-
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: 4 comments 6 replies
-
|
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.
-
@smach regarding your comment on draft and rendered doc, I suggest looking at the different way draft are designed to be rendered: https://quarto.org/docs/websites/website-drafts.html#appearance-of-drafts The default is to create the .html file in the output dir but make it empty, and don't list the file in the navigation. For the default blog, here is the example of content that is all; And the post is not in the listing So when you render your site, your draft post will not be publish on your website. So I understand that if you commit your So in addition to the git workflow previously mention, you could consider adapting workflows. As a reminder, If you need to commit your _site, you could also leverage this behavior by considering you locally need to run Another idea for workflow adaptation is considering Project profile (https://quarto.org/docs/projects/profiles.html) where you could have one with your published output directory that would commit Those are just ideas with features Quarto offers. There is no best solution, only the one that fit your personal workflow. Hope this helps with yours. |
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.