Welcome to SteamPress! SteamPress started out as an idea - after all, I was porting sites and backends over to Swift and would like to have a blog as well. Being early days for Server-Side Swift, and embracing Vapor, there wasn't anything available to put a blog on my site, so I did what any self-respecting engineer would do - I made one! Besides, what better way to learn a framework than build a blog!
I plan to put some more posts up going into how I actually wrote SteamPress, going into some Vapor basics like Authentication and other popular #help topics on Slack (I probably need to rewrite a lot of it properly first!) either on here or on https://geeks.brokenhands.io, which will be the engineering site for Broken Hands, which is what a lot of future projects I have planned will be under. This however requires DynamoDB integration with Vapor (which the Swift SDK work has been started here) as that is what I use for most of my DB usage (it's cheap, I don't have to manage any DB servers etc and I can tear down/scale web servers and the DB will scale in parallel without me having to do anything). But I digress...
I designed SteamPress to be as easy to integrate as possible. Full details can be found in the repo but as an overview:
You need to add it as a dependency in your
dependencies: [ ..., .Package(url: "https://github.com/brokenhandsio/SteamPress", majorVersion: 0, minor: 1) ]
Next import it at the top of your
main.swift (or wherever you link it in):
Finally initialise it:
let steamPress = SteamPress(drop: drop)
That’s it! You can then blog away to your hearts content. Note that the first time you access the login page it will create a
admin user for you, and print the credentials out (you need to restart the Heroku app at this point to flush the logs for some reason if you are trying to run on Heroku)
One of the reasons for writing this post is to show off some of the features of SteamPress! As you can see, we have blog posts (obviously!), multiple users for the blog and you can tag blog posts with different labels to help categorise posts. Currently (especially in the example site), the list of users, labels etc isn’t particularly functional but it will be expanded over time. We also have pagination for large number of posts.
There are also some hidden features that prove useful. You can write posts in markdown and then use LeafMarkdown to easily format your posts. Combine it with some syntax highlighting (I use http://prismjs.com on this site and you can easily write code and have it highlighted for you, as seen above. Great for technical blogs especially!)
Other things include:
- Proper testing!
- Remember Me functionality for logging in
- Slug URL for posts - helps SEO and makes life a bit easier!
- Image uploading
- Blog drafts
- Sitemap/RSS feed - again for SEO
- Searching through the blog