Home
Support Forums

Want Netlify to use pre-generated pages from GitHub

stupefied-albattani-9239e6

I’m using Publii to generate blog posts. It creates 3 directories:

input
output
preview

I want Netlify to take the contents of output and use it as-is. I’ve tried setting the base directory to “/” and the publish directory to “/output” and that doesn’t work properly.

I’ve tried omitting the base directory and having the publish directory set to “output” and that doesn’t work properly.

I’ve tried adding “ls” as a build command. I don’t expect it to generate anything but I thought having an actual command in there like “hugo” or “Jekyll build” might trigger something in the build sequence.

What I’m hoping to accomplish with this sequence is to have my post backed up onto GitHub every time I publish and to use very few build minutes since it’s just copying files from GitHub.

There’s an option to post directly to Netlify from Publii but that means I have to remember to manually checkin changes to GitHub if I want things backed up.

Do you have a repo to view please? :slight_smile:

Hi, @jdeibele. The build system is Linux and on a Linux/Unix system “output” and “/output” are not the same directory (unless your working directory is already / but that is not the case with the build system).

Also, where do these directories (input, output, and preview) exist? Are they directories in the upstream the itself or on some other system? If they are in the upstream repo, then make that directory (relative to the base of the repo) the publish directory. No build command is required in this case.

Note, committing the results of the build command itself to the repo is usually considered an anti-pattern so I would not recommend doing this if this is your plan. It does sound like this is your intention and, if so, you might reconsider.

If the “post build” files exist outside of the repo (and, again, I do hope they are not part of the repo itself), then it might be the manual deploy solution you are looking for. Using the Netlify CLI tool is the most common way to make manual deploys from a local (or third-party) system. There is a link to the CLI manual deploy documentation below:

The site does appear to be working now. Did you resolve the issue? If so, what was your solution?

Hey, Luke and Aaron. Thanks for offering to help.

I was using Publii on my Mac because it was fairly WYSWIG and I thought that would be helpful. Having issues, I turned to Hugo and got that working instead. I want to write on my Mac, do a git push to GitHub, and then have Netlify get the changes. I have that also working for Pelican on a different blog.

The issue is that Publii isn’t something that can be called by Netlify. I do think it would be nice to have the option to generate the pages with Hugo on my Mac and then push them to GitHub and then copy them as-is to Netlify. But I might be the only person who thinks so.

Thanks very much for offering to help.

You can absolutely publish as-built pages to Netlify, unless I’m missing something? You can make use of the CLI and introduce something that suits your workflow!

Using Publii specifically, there’s this: https://getpublii.com/docs/build-a-static-website-with-netlify.html#configuringpubliifornetlify

What I wanted to do:

  1. Write on my Mac with Publii
  2. Add/Make changes to GitHub
  3. Publish to Netlify

Publii absolutely said they support GitHub Pages or Netlify. But I don’t think they support GitHub and Netlify. Instead of running Hugo or Pelican on Netlify, I just wanted Netlify to serve up an already-compiled public directory. That doesn’t seem to be a typical use case.

I wanted to use GitHub to get more familiar with git. Trying to use different themes and plugins has helped a lot with that.

Thanks!

It’s absolutely fine – and a frequently observed use case – to use Netlify only for site deployment, not site building. You can just push your changes in Git without a specific build command, no? :slight_smile:

OK, it wasn’t clear to me when setting things up that you could omit the build command. I’ve now tried Expose for a photo blog and pointed Netlify at the _site folder and it works fine. So to anybody else who worries about supplying a build command, no, you don’t have to do that. Just build on your machine, push to GitHub, and let Netlify take it from there.

I’m still working on what software to use - Expose is most of the way there but stopped getting updates 4 years ago. https://www.deibele.org/ looks nice (to me) but I don’t want to add a ton of photos until I figure out what software I’m using. I will say Expose is an excellent case for doing the work on your own machine: it takes several minutes to work, even with only 21 photos.

I was trying to figure out how to work with GitHub and Netlify and different static site generators at the same time. What would have been nice is to have one SSG with a handful of themes that worked 100% out of the box. Below are my notes from Pelican. Hugo was similar.

THEME = “themes/aboutwilson”

THEME = “…/pelican-themes/bootstrap2” #2020/11/01 categories in header, jammed together

THEME = “…/pelican-themes/buruma” # 2020/11/01 doesn’t work

THEME = “…/pelican-themes/clean-blog” #2020/11/01 doesn’t work

THEME = “…/pelican-themes/elegant” #2020/11/01 no text under posts

THEME = “…/pelican-themes/foundation-default-colours” #2020/11/01 categories in header, looks like Hugo’s Bootstrap

THEME = “…/pelican-themes/gum” #2020/11/01 looks good, links to Archives and Categories have blog post in URL

THEME = “themes/Flex” #2020/11/01 links to Archives and Categories have blog post in URL

THEME = “…/pelican-themes/hyde” #2020/11/01 OK, kind of like flex, border for pictures, look like it could handle caption

THEME = “…/pelican-themes/new-bootstrap2” #2020/11/01 categories in header, images don’t fit right on main page

THEME = “…/pelican-themes/nice-blog” #2020/11/01 doesn’t work

THEME = “…/pelican-themes/nmnlist” #2020/11/01 bad - all links on home page

THEME = “…/pelican-themes/notmyidea-cms” #2020/11/01 doesn’t work

THEME = “…/pelican-themes/pelican-b-side” #2020/11/01 categories stuffed in header

THEME = “…/pelican-themes/pelican-bootstrap3” #2020/11/01 doesn’t work

THEME = “…/pelican-themes/storm” #2020/11/01 categories converted to tags

THEME = “themes/Peli-Kiera” # 2020/11/01 short summaries, categories crammed in header

THEME = “themes/simplify” # 2020/11/01 categories overflow home page

THEME = “…/pelican-themes/stirring” # 2020/11/01 doesn’t work

THEME = “…/pelican-themes/svbhack” # 2020/11/01 links to Archives and Categories have blog post in URL

THEME = “…/pelican-themes/uikit” # 2020/11/01 doesn’t work

THEME = “…/pelican-themes/yapeme” # 2020/11/01 doesn’t work

THEME = “…/pelican-themes/zurb-F5-basic” # 2020/11/01 links to Archives and Categories have blog post in URL, title squished

Woop! Yep, it can certainly be blank. Progress! Glad you’re having fun.

For sources of truths, I’d consider https://jamstack.org for SSGs and, if you’re a theme user, maybe https://jamstackthemes.dev – it’s updated frequently so you can get your hands on very current themes!

@jdeibele At the risk of stating the obvious, the easiest way to accomplish what you want to do with Publii is to disconnect Github from Netlify for this project, and then just drag-n-drop the output folder onto your deploy dashboard for this project in Netlify.

If Publii would allow you to store a .git folder in the output folder without overwriting it each time it builds, you could also delete your project’s current repository on Github and then git init only the output folder, but I’ll bet this is not possible.