8 ms·
Show HN: Publish blog post with a simple Git push
- johnnyo 10y agoHow is this different from Jekyl?
- christophersu 10y agoLooks like this doesn't generate a static site, but instead dynamically reads the content out of the blog "post" files and renders it on request.
- snehesht 10y agoI haven't used jekyll much but I would say this stores posts in separate git repo (github.com/snehesht/blogposts) and user doesn't need to update the server every time he publishes a new post. It uses github webhooks to alert server of any events related to the blogposts repo. The server verifies the events using HMAC authnication ( see github docs for more info) and then updates the local blogposts repo ( git pull)
- flohofwoe 10y agoWith github pages and Jekyll, updating the blog is also just a simple push of the Jekyll sources. The HTML page generation will than happen on github's side. Of course with this, you're locked down to 2 techs, github and Jekyll.
- icebraining 10y agoNot really locked in to Github, it's easy to replace it with any git server using a post-receive hook.
- danso 10y agoBeing locked into Jekyll is not such a huge deal, as the posts are all Markdown with some YAML frontmatter, and other systems use the same post conventions, such as Middleman. Github only provides the convenience of not having to install Jekyll on your own system in order to publish. If you want to throw it up to S3 or any other static file server, you just have to run `jekyll build` yourself.
- jalami 10y agoI considered doing this with my hugo blog, but decided I wanted to do the work on my client and keep my server stupid. In order to build my site, I have a lot of minification, pdf generation, syntax highlighting etc, that requires a few packages to be installed on the client. If my server had to rebuild after a git push of a new post, I'd have to install all of the tooling on the server. I just commit my post, then run npm deploy which rsyncs all the static assets to the server after building on the client. This also makes it so I can see everything on my client easily before deploying. If I was building a blog for someone else though, this would make sense, stupid client, smart server, commit from anywhere.
- snehesht 10y agoMy motivation for this project was simple, I need a good interface to write my articles from different devices and able to publish them without touching the server. I built this in such a way I don't need to think about database backups, server side authentication, using dropbox to sync my unfinished articles. This architecture offers me freedom to write on my phone (Termux) during commute or sitting in the office and keep track of changes using git and finally publishing the post by simply adding a record into metadata.json.
- jalami 10y agoYou could throw Jekyll, Middleman, Pelican or Hugo on the server and run their build command with a git hook. Then you'd get the same result, but a completely static website without the server needing flask to piece together pages when a user hits the site. The build times wouldn't be instantaneous as it would need to regenerate all the pages, but Hugo is still really snappy for even a large site. You probably post less than users access anyway. This would still check all your boxes: No database No server side auth Non-public drafts (metadata) Commit from anywhere Bonus: Dumb serving (only prebuilt static pages) Optional bonus: Shortcodes, themes, bells whistles The site would be built on the server so it wouldn't be completely dumb like rsync-ing static pages to nginx or something, but that's the rub if you want to be able to use clients with only git as a dependency. Yours is a good solution, I'm just throwing an idea out there for a pre-baked alternative. My original use case didn't call for mobile blogging (not a fan), I run my own gitolite server so auth is already in my camp and I have a multi-tooled build that I didn't want on the server. If something breaks, it happens on my machine instead of on my server. Also just a tip, maybe you want to put a <noscript> tag around an expanded copy of your hamburger menu. Without javascript, your website navigation is broken because you can't expand the menu. Edit: by client, I mean blog-editing-computer not blog-reader's-computer.
- worg 10y agoAlternatively you can setup a pipeline on gitlab and let the runner build/publish your blog
- snehesht 10y agoThat's an interesting idea, but I wanted this blog to be as simple as possible.
- jads 10y agoAlways like seeing these types of projects. One piece of feedback: that gif of the process needs to be recreated. It's far too quick and the erroneous key strokes and typing/deleting is really confusing. Recreate the gif, but make it slower and error free to clearly demonstrate the process.
- snehesht 10y agothanks, It's rather long ( ~ 1:30 mins ) so I increased speed by 2.5x.
- JoshTriplett 10y agoMost browsers support embedded videos now, which have the advantage that you can rewind and pause. You could also provide a transcript or static screenshots.
- bentpins 10y agoThe unfortunate thing is that GitHub flavoured markdown doesn't yet support webm or other types of video embed.
- icpmacdo 10y agoIf you use github pages you can use the HTML5 video tag, here's an example from my account's Github pages https://icpmacdo.github.io/ https://icpmacdo.github.io/ https://github.com/icpmacdo/icpmacdo.github.io https://github.com/icpmacdo/icpmacdo.github.io
- snehesht 10y agoGithub pages renders html so by default it supports video, However It's totally different case with markdown files.
- smartbit 10y agoNow it is too slow and I got bored waiting ;-)
- jradd 10y agoDamn, this is cool. I have been meaning to build something similar, inspired by Gollum, or Jekyl.
- ams6110 10y agoI've been publishing stuff on the web for years using just a simple scp.
- snehesht 10y agoscp is useful as always.
- pavlov 10y agoOr rsync...
- laurent123456 10y agoAnd if you need versioning, just create a git repository on the remote server. rsync -a ~/blog/ user@host:~/blog && \ ssh user@host 'cd ~/blog && git add --all . && git commit -m "udpate"'
- gkya 10y agoShouldn't one not version-control the build-output?
- hendzen 10y agoIt would be cool to implement this as githook -> AWS Lambda -> publish to s3 bucket.
- snehesht 10y agoLambda is cool to some extent, actually I'm working on a side project that relies heavily on aws lambda.
- shade23 10y agoDont want to be a bubble-burster here.This can also be achieved by picking any of the blog engines[1] and hooking it up with a CI. Gives you much more legroom then right? [1]:https://www.staticgen.com/ https://www.staticgen.com/
- wsc981 10y agoThere's this guide on a "one cent blog"[0] that I've used to create my own website / weblog with a custom domain. It uses Jekyll, CloudFlare and Travis-CI. Probably a bit more work to set up then the tool created by the OP, but also more flexible, I would think. The end result is much the same though. A simple 'git push' is used to publish the blog. --- [0]: https://hugotunius.se/2016/01/10/the-one-cent-blog.html https://hugotunius.se/2016/01/10/the-one-cent-blog.html
- K0nserv 10y agoI'm the author of "One Cent Blog" thanks for the mention glad it helped you. One interesting difference between the approach described in my blog post(or any other static method) is that you are not relying on a server or a database that can fall over if you get a lot of traffic from say HN. Having static files is a blessing because it scales wonderfully. The approach in this post relies on maintaining infrastructure, keeping it up to date and patched which for me is a lot of extra work I'd rather not do. Using a standard VPS it's a lot more expensive too.
- codazoda 10y agoI do this with jekyll and github but without s3 or travis-ci. I skimmed over the blog but couldn't understand what value s3 adds vs letting github host it. Cloudflare can do the https bits with github directly.
- K0nserv 10y agoThe main value is escaping the constraints on plugins and gems you are able to use with Jekyll on GitHub pages. Don't remember of the top of my head but I believe it's pretty limited.
- Flaiming 10y agoSeems to me that publishing blog post through git push is much more work than use some admin interface (for example Wordpress). You can use it from any device (without aby app for CLI interface). You can use for example VersionPress[1] for backups to git. And I don't get what's the point of publishing without touching server, since you need to touch the server to view published post. [1] https://versionpress.net/ https://versionpress.net/
- jalami 10y agoDifferent strokes. I think maintaining the LAMP Wordpress stack, extensions, admin panel auth security, whatever versionpress is etc. is more hassle than editing a text file and pushing code. To devs, this editing is second nature. Also, I'd take my desktop editor to a contentEditable any day.
- snehesht 10y agoI used wordpress for a couple of years, It's good for a general purpose blog, but as jalami said I like CLI than web interface and it's too much hassle maintaining WordPress( Regular updates and security patches, database backups and sync to dropbox or s3 )
- WorldMaker 10y agoGithub has a nice web interface for directly editing files and creating Git commits from them (and Pull Requests), which is why I like to stick to the GH Pages flavor of Jekyll. It's nice having the option for a web interface for quick edits and the editor of my choice for long form posts. The Github website is the only reason I use Jekyll over many of the more recent alternatives like Middleman/Hugo/et al.
- steffoz 10y agoWith a CMS for static websites like DatoCMS [1] you can have the best from both words: edit your post from a good old web interface and publish a rock solid, stupid, static website. [1]: https://www.datocms.com https://www.datocms.com
- rcarmo 10y agoBoth my current[1] and previous[2] blog engines work like this - as long as the post tree is updated by git or Dropbox, they're perfectly happy. Plus I can use whatever markup I want (even Jupyter notebooks). 1: https://github.com/rcarmo/sushy https://github.com/rcarmo/sushy 2: https://github.com/rcarmo/yaki https://github.com/rcarmo/yaki
- p4bl0 10y agoReminds me of my old project (still in use to this days by something like a dozen people) fugitive [1]. [1] http://shebang.ws/fugitive-readme.html http://shebang.ws/fugitive-readme.html
- nicky0 10y ago"simple" and Git don't go together.
- jackweirdy 10y agoIt's not user hostile, it's just only expert-friendly.
- avindroth 10y ago"Simple" and Magit, however, go together like peanut butter and jelly.
- flukus 10y agoGit add/commit/push/pull is all you need to know for a typical blog. Doesn't get much simpler than that.
- ramswaroop 10y agoGreat project. Cheers! I see that you use keybase.io, can you send me an invite if that's okay for you?
- snehesht 10y agoThanks, I got mine from a friend, I'll check if he have any invites left.
- abstractbeliefs 10y agoAre you still looking for an invite?
- ramswaroop 10y agoI got one yesterday. Most probably a Hacker News reader gave me one :)
- romanovcode 10y agoYeah Gitlab provides this type of functionality out of the box. Whenever I commit something to it I get updates on my website[0] immediately. Same for my CV[1], whenever I change it in gitlab it picks it up, compiles the latex to pdf and replaces the cv.pdf file. [0] https://gitlab.com/stanislavromanov/stanislavromanov https://gitlab.com/stanislavromanov/stanislavromanov [1] https://gitlab.com/stanislavromanov/cv https://gitlab.com/stanislavromanov/cv
- michaelmior 10y agoSo does GitHub https://help.github.com/articles/about-github-pages-and-jekyll/ https://help.github.com/articles/about-github-pages-and-jeky...
- kayman 10y agoI use a similar workflow. Emacs Org mode --> HTML --> Git Push --> Auto Publish
- deleted 10y ago[deleted]
- fiatjaf 10y ago`git push` is in no way simple.
- flukus 10y agoWhy not? are you saying the CLI isn't simple or git in particular?
- minhajuddin 10y agoShameless Plug: https://zammu.in/ https://zammu.in/ is something which I built. It is a CI for static site generators like Jekyll/Hugo/Middleman etc,.
- michaelmior 10y agoWhy would I want to use Zammu over just using Travis CI or any other existing CI service? The only new feature I see is scheduled deploys. (It's not clear to me from the description on the site how this work.) Unfortunately it doesn't seem the SSG I currently use (Wintersmith) is supported anyway. Although I don't see why adding specific support for each system should be necessary.
- fiatjaf 10y agoWhat about commit names? Here's what happens when you use git for commiting changes that do not support a meaningful name: https://github.com/github/developer.github.com/commits/gh-pages https://github.com/github/developer.github.com/commits/gh-pa...
- libeclipse 10y agoHow is this different to hosting a Jekyll site on github?
- gkya 10y agoJekyll on Github does not allow plugins. Though I'd say that this seems to be a bit an overkill, one shouldn't need cntainers for this kinda task. Best approach would be local build+rsync/ssh for a normal hosting. For github, I'd build the site targeting another git repo that I'd push to github.