oleeskild / digitalgarden

285 stars 157 forks source link

How to preview before publishing? #39

Open dalbasti opened 1 year ago

dalbasti commented 1 year ago

I wish there is a way to preview my site before deploying it to the internet. Is there a way to build digital garden locally?

oleeskild commented 1 year ago

There is no built in way to do this. I guess the easiest way to do it would be to create two repos and sites. One for the actual site, and one for previews. And then just change the repository name setting in obsidian depending on if you want to publish it to the preview site or the actual site. Would that work?

dalbasti commented 1 year ago

Well, since there is no other way, this might be acceptable. Still, I wish it would be possible to find a way around. Thanks.

Tomaubier commented 1 year ago

This might not be the cleanest way to do it but you could make a repository branch including the app.js script given here. This would allow you to run a local version of your digital garden before merging changes to the main branch.

johndsmith2024 commented 4 months ago

I've found a neat way to preview my site before deploying, using Netlify. The doc on Netlify website is a bit unclear, but here is how to do it: First thing to note: every time Netlify builds, it automatically generates a Preview Deploy, with a unique URL, but it also auto deploy to production. What you want is to disable auto deploy, so you can preview the change before manually going live. Steps:

  1. Go to your site config page, choose Deploy tab from the left menu
  2. Click Lock to stop auto publishing (it's unlocked by default so every time you push code to git it will automatically build, then automatically deploy)
  3. On the same page, you will see a list of builds, with the latest on top. When you make change, wait for the build to complete (for digitalgarden site, it can take >30 seconds). Then click on that latest build
  4. In the detailed page of that build, scroll down to Deploy Log, and click Preview, it’s a link to a preview site with a unique URL where you can see the site with latest changes without affecting the production site
  5. If satisfied, go to main Deploy page, and click Publish Deploy

When you don't need to preview Deploy, you can click Unlock to start auto publishing.