70 points · by chauhankiran · 8y ago · 90 comments
Many of you might have some scripts that generate your blog posts from some setup. If it is possible then can you share your setup configuration?
I am looking for following things with setup:
* I should have backup of my all posts if I want to move other other configuration. * I can easily tweak css or html. * I can generate a complete html blog that can be publish over GitHub or any other places.
Netlify is like Heroku for static sites. You can connect Netlify to GitLab (free private repos), and Netlify will build and deploy your site when you git push. I also use the Netlify nameservers for many of my domains, and it's really easy to set up SSL with Let's Encrypt. I can buy a domain on Namecheap, and have a new blog or landing page deployed in less than 5 minutes.
The goal is to have Ruby 3 run 3× faster than Ruby 2.0; Ruby 2.5.0 is at 165% of Ruby 2.0 right now: https://appfolio-engineering.squarespace.com/appfolio-engine...
I assume the ordering of or, if, etc is a byproduct of them being function calls, but I'd have to double check to verify. Regardless it's a little weird at first but you get used to it after a bit. I used a fair bit of customization on the www.calhoun.io theme and I didn't have to think twice about the order of terms after a short while.
This was a useful site for deeper exploration into the syntax. Sometimes, it's just trial and error.
These are the things that keep me with Jekyll and middleman.
You can run "gulp watch" to compile the files into /static, and Hugo's live reloading will pick up the changes.
I can't find anything about slim templates. "Hugo uses Go’s html/template and text/template libraries as the basis for the templating.": https://gohugo.io/templates/introduction/
It does support partials, and the go templates are similar to liquid.
I honestly don't do much to customize Hugo, I just pick a theme, tweak the CSS, and write some blog posts. If you have a Jekyll blog with a lot of custom Ruby, then it might be difficult to switch.
* Kickstarted in 2013
* Markdown-based
* Open source, self-hostable
* Hosted solution (https://ghost.org/pricing/) with support for your own domain name
* Beautiful themes out of the box with custom css/js on an article, site-wide or theme level
* Third party static site generation tools (https://github.com/axitkhurana/buster/, https://github.com/lexoyo/static-ghost)
Example blog (default theme): https://blog.ghost.org/
I self host on the lowest Digital Ocean droplet which is now $5/mo and is plenty for my small time blog and I'm happy to pay $5/mo for the delight of using Ghost. Also with a cron job I can auto-update every few days and get the latest features without touching the box.
Ghost will auto-roll back if an update fails which is nice and I don't have that many viewers so if it goes down I don't mind so much right now.
A final bonus is that it uses handlebars for it's theme creation and rendering. I'm a node dev who uses handlebars for my own projects so editing my theme is a breeze.
https://github.com/lucaspiller/hugo-privacy-cactus-theme
I wanted a minimalist theme that's fast to load, but a lot of commonly cited examples are too extreme or look too dated for my liking. I wanted the same results, but something a bit more up to date and with code highlighting. You can see the end result on my blog (total network transfer 78kB):
http://www.stackednotion.com/blog/2016/07/09/setting-up-a-ne...
Then your scss/less->css is probably best done with the command line compiler, driven from your build tool.
And for HTML, take a template language you enjoy and write a simple driver script. If you want multiple templates, add metadata to your source files. In my case I want Markdown->HTML, using various templates, so I use YAML for the metadata, then Python's markdown compiler, and finally Jinja2 for templating. Again you can write the driver in a few dozen lines for your own purpose.
My build tools then calls The AWS API to send it to its S3 bucket, in most cases. But in one it commits to a github pages branch and pushes.
It is exceptionally simple to code your own static site generator, if you can do basic command line scripting. And doing it that way allows you to be very flexible and add things like uploading, version control, etc.
I think it's better off seen as a command line tool, than a special 'static blog generator' task. In general I think we are erring too far on the 'build a niche vertical app' rather than 'automate powerful general-purpose tools'.
https://abhi.keybase.pub/2016/02/15/git-and-keybasefs.html
The general gist is that keybase.io is promising that it will only serve data at abhi.keybase.pub that has been signed for by that user.
It's written in Node and features multithreading and incremental builds for fast development.
I host on Netlify, which has continuous integration built in, so it builds and deploys the site every time I push to GitLab.
add a plugin from the repo "simply static" - generate the html files.
download, then ftp.
It's not elegant and lean like the others - but it's saved me a ton of time for the use cases I've used it for.
There is another decent static generator in the repo, but it failed on a recent site I was trying yesterday, so it's not on my currently using list.
I know it's possible to put wp dynamic files on a server and use a domain mapping plugin to generate files for a bunch of domains on the same server easily - could probably find someone smarter than me to add in this simply static plugin and mod it to shoot the files to the sub domains...
then just install a bunch of themes and other plugins to the main install - and might be kind of heavenly for a lot of situations.
Some of my wp sites need contact forms - so I'm leaving those live / dynamic. If it was easier to make and upload something like the coffee cup form builder files I'd convert a few more sites to static files this week.
If someone found a way to use the wordpress themes with these other generators it would be awesome. Then it would just be the few sites that need the extra plugins power that really need the wordpress php files and such. One can dream.
I would use VSTS for the whole pipeline, including the Git repository hosting, but I wanted to have a public repository, in case listeners wanted to submit pull requests. So far that hasn't happened, so I'm missing out on some of the VSTS features, but maybe it still will.
I also have a weekly newsletter (https://developertoolsweekly.com/) that uses a static site generator that I build myself. It's very Jekyll-inspired and uses Liquid templates, but instead of generally processing markdown, it takes a simple list of links and descriptions and emits a website as well as the HTML and plain text for the emails.
This workflow is similar, the generator is run in a Docker container, but this workflow is entirely VSTS and Azure.
It's very flexible, written in python, easy to customize, has plugins for any purpose.
I've made a custom theme, configured pelican a bit, and served with nginx on digital ocean(but it could as well have been served for free on github pages).
You can see the code and my custom theme here:
After writing I run `post.sh` with the file as the argument. It invokes a Python script which generates the HTML and puts it in a directory for published posts sorted by date/month/year (e.g. published/2018/01/29). The Bash script generates a directory/link listing and an index page for the blog roll, followed by a "git push".
Less code and configuration makes it easy to add custom features; I stuck incremental rebuilds and hot reloading into my blog while keeping it below 70 LOC:
https://github.com/1wheel/roadtolarissa/blob/master/index.js
- [0] https://gohugo.io/
- [1] http://themes.gohugo.io/
- [2] https://pages.github.com/
- [3] https://www.digitalocean.com/
- [4] https://www.robinwieruch.de/own-website-in-five-days/
- [5] https://www.robinwieruch.de/deploy-applications-digital-ocea...
Happy to share with anyone who wants it. Some day I'll get around to putting it up on github.
Then now. Personal opinion but I love Gatsby ( https://www.gatsbyjs.org ). For me, it is the best static site generator out there. Yes more than static site generator as it is a PWA by default. It is infinitely scalable. It prefetches content before its loaded (think about this as you get the data of Previous Blog Post & Next Blog Post when you are on the Current Blog Post). Its so fast that you will actually feel the speed. Also, with little efforts you can make it work offline too.
When I'm ready to publish I just copy the public directory right to my webserver, but I could just as easily publish to GitHub or the like if I didn't enjoy maintaining my own domain.
In short, I just write my content in markdown, style in Sass and HTML in Tera (https://github.com/Keats/tera/) which is very similar to Jinja2.
I then automatically build & deploy from https://www.netlify.com/ on commits. Netlify will also get built-in support the next time they deploy their build image (ie all you need for your site to be deployed will be a file like https://github.com/Keats/gutenberg/blob/a2b55a927981727ce00a...) like Hugo does.
My own site is a bit difference as I have a DO instance for it but the script is simply copying the public folder to the server and have Caddy serve it.
So I made my own tool.
With this tool (which I dubbed ‘Wabi’) you put a bunch of files in a folder and the files are processed and copied to a corresponding location in an output folder.
Files with metadata at the top are processed specially and can be used as templates or to write markdown files that are turned into pages.
Wabi helps you setup Git integration so that when you run the “publish” command all local changes are immediately published to your website. I didn’t want to mess around with git stuff most of the time so I implemented that command so I could publish iteratively and quickly.
Wabi is sort of my answer to wanting control over how I build my website, while also wanting a tool that does not get in the way of the creative parts of making and running a website.
That said, it’s of no use to you because it’s completely undocumented and not polished, but probably over the next few months I’ll fix it up as I use it to create my own personal website. For those interested you can check out the source (it’s written in Go): https://github.com/kettle11/wabi
I'm currently writing a post detailing how all of this works, for anyone interested.
git subtree push --prefix build origin gh-pages
is a nice simple way to push your build directory to the gh-pages branch.Yes please. I need to support localisation on a site I maintain, and for that will need one (or more) plugins that github don't support so would be interested in your setup.
What has worked best so far is Org publishing. The reasons I prefer it are primarily that
1. The Org file format is olain text, easily edited on the phone and generally great.
2. I can embed source code in many different languages and have it execute during publishing and embed its results in the document. This can be used both for a "Python notebook" style document, and to programmatically generate things like markup!
3. I can write a single coherent document and then slice it different ways to publish one technical manual as PDF, one summary blog post, and some slides with key points -- all from the same source material.
4. The publishing process is very hackable, so customizations are easy.
(Of course, you don't have to use Emacs as your editor, you can just create a git hook or alias to run Org publish in shell script mode.)
we choosed this setting because we wanted the content-heavy parts in an easy to handle CMS (from a editor perspective). We wanted to integrate the content in our main webshop and not with a subdomain and between our main header and footer coming from our main webshop system (sap hybris).
https://github.com/sumdog/jekyll-multisite
There are open issues and pull requests for the plugin. I started building a test suite so I could start doing tests against multiple Jekyll versions and make it more universal, but it currently fails tests even with the same Gemfile/lockfiles.
Currently I have to keep my site pegged to Jekyll 3.0.1 because of all the custom plugins I've written, and think Jekyll-multisite might be tied directly to my build. :( I've put little effort into it lately since Jekyll themes are suppose to address the multi-site capabilities. I just keep it building a a docker container so I can use the older version without trouble.
I have that nginx container running behind the official HAProxy container and have Certbot running in its official container as well. I have a guide on how to set this up including all the Dockerfiles on github that you can use and modify:
http://penguindreams.org/blog/bee2-automating-haproxy-and-le...
As you can see, my blog isn't on the new setup yet (no https/letsencrypt). I'm working on that though, and hope to have it all migrated over this week.
I would NOT recommend Jekyll if I was starting again. I had to do a lot of hacking and custom ruby coding to get really basic things I wanted working. Under the shell of Jekyll is a huge mess. It likes to iterate over things .. a lot .. all the time, for everything. Lots of the path resolution stuff is broken and lots of Jekyll is built around github pages, making some things impossible without violating the security model.
¹ Manual: https://heerdebeer.org/Software/markdown/pandocomatic/ ² https://pandoc.org/
For your specific issue, and this is a general pandoc solution, filters with side effects could work. For example, you can write a filter that would extract and inspect the metadata and writes it to to an RSS XML file.
In Paru¹, the Ruby wrapper and interface to pandoc, a very naive solution could look like:
#!/usr/bin/env ruby
require "paru/filter"
require "rss"
RSS_FILE = "my-rss-file.rss"
title = "No title"
date = Time.now.to_s
# Collect metadata information while filtering a document with pandoc
Paru::Filter.run do
title = metadata["title"] if metadata.has_key? "title"
date = metadata["date"] if metadata.has_key? "date"
end
# Create new Atom item
new = RSS::Maker.make("atom") do |maker|
maker.channel.author = maker.channel.about = maker.channel.title = ""
maker.channel.updated = Time.now.to_s
maker.items.new_item do |item|
item.title = title
item.updated = date
item.link = "Some link"
end
end
# Add new item to existing Atom RSS feed
rss = RSS::Parser.parse(File.read(RSS_FILE), false)
rss.items.concat new.items
File.write(RSS_FILE, rss)
(My apologies for the bad code, this is my first attempt at working with RSS/Atom)¹ https://heerdebeer.org/Software/markdown/paru/#writing-and-u...
There are many good themes for Hugo (https://themes.gohugo.io/), I use Beautiful Hugo.
When writing a new post I: * create a new MD file with the post * commit + push * Netlify takes care of the rest (fetch from Github, deploy)
Jekyll really does give you full control. It also powers some pretty large websites. Breitbart.com and Forthepeople.com (shameless plug) spring to mind.
Les of freedom, everything is a plugin. I am going to restart my blog with this.
Plus Vue.js Plus Bulma for CSS (actually Bueify to make it work with Vue)
I've got some custom Jekyll page generation through Jekyll plugins, so I can list out my tags / categories into their own pages.
It's pushed to GitLab.com which runs CI to build the site in docker containers, then deploys to my VPS, but could just as easily be sent to Netlify or S3 or wherever, I just like having it on a VPS.
* Code snippets with syntax highlighting * Embed the results of computations like plots * Mathematical figures * Bibliographic citations * Footnotes
Wrote about it (https://curious.observer/articles/a-modern-blog/), but didn't get to "blogging" until now :)
* http://ontoblogie.clabaut.net/en/posts/201801/use-nikola-gae...
$ make post
It works just fine.
You write your site in react, which is compiled into HTML at build time. After the user fetches the HTML, gatsby prefetches all the resources that might be needed later, so the site feels incredibly fast when navigating.
It is really trivial to build your own for a simple blog site. I like this approach as the toolchain develops alongside the site!
Jinja2 templates, simple Python build script. That way you can write your content in whatever format you like! To deploy just use a bash script. On Github pages you can just git push of course.
I use hugo and deploy to cheap shared hosting with 3 lines long Makefile:
deploy:
hugo
rsync --progress --archive -zLcb ./public/ webhost:~/example.com/
* Cost almost nothing even if massive traffic (I wish)
* Infinate scaling
* No markdown, just html
* Post from browser, no publishing utils
* No web server
* No database
* Important plugins - comments, social media, email list
* Templates (eventually)
Built with jquery, S3, Cloudfront
Finished but not tested, demo at https://jamackinnon.com
Please let me know if you need help.
No "configuration". All code. You have to assemble the libraries from npm to make anything useful out of it though. Good luck.
For hosting I use cloudfront -> lambda -> s3. There is a lambda for incoming requests that handles some routing, and a lambda for responses from s3 that applies various security headers (HSTS, CSP, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Expect-CT, X-XSS-Protection).
I also have certbot (an ACME/LetsEncrypt client) running in a lambda once a day - if my TLS certificate has < 30 days remaining it will provision a new one and import it to be served by Cloudfront automatically.
The whole thing is serverless, can handle arbitrary amounts of traffic & is very fast, and no maintenance at all. It costs me about $1.50 per month.
Will simplify your stack a little by removing the LE step
http://mulholland.xyz/docs/ivy/
I use it for all my sites now.
Here's the git repo https://github.com/snehesht/blog
2) what about for non developers? I can't get my sister to start using SCSS, much less Docker or GitHub. The 2018 version of Frontpage or Dreamweaver ...
You do realize that Jekyll themes are basically just finished projects people use because they can't believe bothered to create their own site, right?
running on GitHub Pages + Netlify