So, suddenly, instead of 2 themes for download, you have ~65 (although of
course, most of them are bootswatch variations in 2 themes,
jinja-default looks exactly like default, and orphan is useless ;-)
All you have to do is add your theme in themes/ and pull request.
Send me a zip of your theme and I'll do it.
Contributing themes will take a while because the theme has to be examined for
malicious code in the templates, but I will process them, slowly but surely.
If you have sent me a theme in the past and I have not done it, I am terribly
sorry and hope you can find it in you to try one more time :-)
The themes site itself is not exactly awesome, but it is functional, and you can
get themes from there too, and see demo sites for each theme, and even look at
autogenerated screenshots (which sadly don't show webfonts)
I had this issue open in the bug tracker for Nikola (my static site generator) for a long time: "Add mincss support".
Well, no, it doesn't have it yet, but I did some research on whether it would be worth adding. And
boy, mincss impressed the heck out of me.
You see, Nikola's themes tend to use unadultered bootstrap, which means they carry a large number of
things that are not used in their CSS. Besides, it uses several stylesheets from docutils,
pygments, and more.
What mincss does is examine your HTML and your CSS, and remove all the unused CSS.
So, I wrote a script that examines the Nikola output and overwrites the CSS files
with the minimal things that are actually needed there.
And the result?
Here is the before/after for each CSS file in Nikola's demo site:
But wait, Nikola supports bundling all those files into a single large CSS file to avoid network
requests (using webassets). Does it work in that case too?
all-nocdn.css 167457 29496
But that is not all. The mincss files are not minified. Passing all-nocdn.css through Yui-compressor
shrinks it further to 20599 bytes. Which, gzipped, is a paltry 4801 bytes. That means the complete styling of
the whole site is a single CSS file less than 5KB in size.
Over a year ago (time flies!) I posted something about a project called Alva. Let me quote myself:
Alva is almost the opposite of Nikola. If Nikola is about making static sites, Alva is a dynamic site. However, as Hegel suggests, from the thesis and the antithesis comes the synthesis.
So, Alva is about dynamically creating static sites. If you want to have Nikola in your server instead of in your own computer, and have the convenience of an online tool, that's the niche Alva tries to fill.
So, you would install Alva, and use it like any other web-based blogging tool. Yet, behind the scenes, you would have Nikola, and all the performance and security benefits of static sites.
And maybe someday, I (or someone) will put up a multi-user version of Alva, and you will be able to get hosted blogs, knowing all the data is yours and you can leave anytime and do your own thing.
The approach I was taking at the time proved to be unsuccessful, and there were a few other failures along the way. Of course, the problem was in how I was approaching the task. So I did the right thing, and learned how to do it "right".
Still not usable, still not hosted anywhere, but already semi-functional: Alva lives now
There's a lot of work still to be done. But I now know how to do it. To prevent the usual arguments, here is a little explanation of motivation, tooling, etc.
I want a way to host blogs very cheaply. How cheaply? I want at least 1000 reasonably active users in a $5 VPS. That would make Alva a reasonable alternative to hosted multi-user wordpress,
which means it would be a reasonable solution (if setup is easy enough) for small-to-medium organizations which don't want to setup expensive infrastructure yet want to own their data (think schools, small businesses, FLOSS projects, etc.) I also want to provide that service, for free. Which is why another reason I want it to be super cheap.
How does Alva help provide this super-cheap blog hosting?
It needs to scale following the number of edits not views.
If it gets too busy with edits, changes take longer to appear, but the site itself doesn't get any slower.
Editing and serving can be provided by separate services, so I can use some super-fast static file server and a super-configurable WSGI deployment.
Individual pages can be heavily optimized so that they download fast
One of the guiding principles here is that to deliver this sort of thing, in my spare time, the development process needs to be stingy with the most limited resource: me.
I can't spend a lot of me here. I need to be careful and not over-promise.
So, whenever there was a 3rd-party tool that saves a significant amount of time, that's what I am using.
Because it has a much stronger 3rd-party toolset than Flask or any micro-framework. For example, the Flask equivalent of django-allauth broke my will to live.
Because the admin interface means I can start adding data to see if it makes sense before I write all the required views.
Because I don't want you to have to create accounts here unless you want to, this provides (optional) social login and registration.
This was easy to setup and works almsost out-of-the-box
Bootstrap and Django-bootstrap-toolkit
Nikola is already heavily invested in bootstrap, so it just made sense to go further down that road. I understand bootstrap, and django-boostrap-toolkit is
easy enough (although I can't make their datepicker work)
Because fighting is boring.
Because Django's mechanisms to find templates and static files are many and confuse me.
Redis + RQ + django-rq
It's crucial for the whole approach to use job queues in order to detach the rendering from the actual Django app. This combination makes
job dispatching ridiculously easy, setup is trivial (install everything, start redis, a few lines of config, ./manage.py rqworker and off you go)
and they provide a django admin page where I can see the failed jobs, which is awesome.
Because it's easy enough, and allows me some freedom exploring data organization in my models without committing to it forever or recreating databases
with test data all the time.
I will probably serve the generated sites via gatling just like my current sites because it has the simplest named
domain configuration possible, it's fast and very light in resource usage.
A cool, simple editor with live previews that supports almost every markup. Not WYSIWYG or even WYSIWYM so possibly I will have to add an alternative.
I started using django-markitup but it's not a good idea (it uses a old version of markitup which requires JQuery < 1.9) and am in the process of just
using Markitup manually.
So, feel free to give Alva a try and/or give me a hand, comments welcome.
I am a very big proponent of static site generators. I would not have bothered
writing Nikola otherwise. But there is always
that feeling that maybe there is some little thing which is hard to implement, like
a contact form.
And let's face it, the easiest way to solve some of those things is by sticking
a few lines of PHP in your HTML.
So, if you really want to, you can do it. I think Nikola (github master) is the first static
site generator that supports php code. Here's how:
Add php to your page_compilers (because I will never put it there by default):
Build the site as usual, and you should end up with a page with PHP extension,
that has that PHP in the "content" area, so it will follow your site's theme.
Of course you can't do things like add HTTP headers and such, but hey, read the title.