 Hello. How's it going? My name is William and welcome to my talk. Today I'm talking about Nikila. This is my first time being a speaker at KiwiPikon. I've done a couple of lightning talks in the past, first time in 2013 and then again in 2015. So it's really great to come and do a full talk. Yeah, so I hope you enjoy it and you learn a few things. The slides are already up. You can go and grab them if you want, view them and that's the website to the Nikila website if you want to check that out too. And all my slides and all my contents are licensed and they're a Creative Commons attribution license. Alright, this talk's dedicated to my brother. He's over in Sydney at the moment and it's his birthday. So yeah, it's pretty wonderful. This is a photo of him in Sydney. Do you want to guess? Do you want to have a guess? He's the one in the suit there. So I've actually just got to spend the last month with him and in Sydney I just arrived back in New Zealand last night. So it's pretty good to spend some time with him. I hope he has a great day. Okay, a bit about me. So I trained as an artist. I went to art school down in Wellington. I went to a learning connection. And while I was going to art school I taught myself how to code, basically to help my productivity of my artwork. I had an art website still. But it was in WordPress and I switched across to using Nikila using Python for it instead, which was a very good move. A lot of my Python projects involved working with a lot of existing websites, remixing it, and so I do a lot with APIs and stuff, mostly web-based stuff. That's my email there, www.artcontrol.me, if you want to get hold of me. And there's my GitHub as well. So what are static websites? They're basically HTML, CSS, and JavaScript. And they're delivered exactly as they're stored. Well, you've got dynamic ones, which are kind of generated from a web application, like WordPress, for example. They might have like a database and stuff. But yeah, static websites generated as they are. Yeah, and static sites are set up for content that never are really updated. But then modern static site generators solve this issue. No longer do you have to edit HTML and do horrible things like that with generators. It can make the process much easier. Okay, so why static? I kind of already talked about this a little bit. But yeah, the, I've talked about this. Let's carry on. Okay, reasons to use a static site, security. Since it is just HTML and CSS, it's less vulnerable to hacking and stuff like that. And it doesn't do that because there's like no logins or anything like that. You kind of only really need to secure the web server and such. The files, yeah, they're much, much harder to change and stuff. You don't need to update. You don't have to worry about updating your, like, plugins and such like that. Just because the files are there and stuff like that. Cost and performance. You're only serving HTML and that so you can run it on like an S3 bucket and that. So yeah, it's much cheaper and it can scale out really well as well. And the lock-in as well is you own these files. You've got these files. You're not relying on like the database or anything like that or proprietary systems. Some disadvantages with static websites. They're adding like dynamic functions like separately. Like if you want like comments and stuff like that, you have to use like third-party tools like this quiz. I've got mentioned here for like comments. It can also be hard to switch organizations from like what they used to using like WordPress to, for example, to like something like Nikila because it's kind of just scary for them. I've had this issue with like trying to convert Creative Commons user one to it. It's never going to happen. Here's an example of a very popular static site generator, Jekyll. This was created by the GitHub co-founder and GitHub pages run on this. Unfortunately though, it is Ruby. But it's still very popular. Pelican. This is a Python static website generator. The next kernel uses it for the blog. Fortunately, they don't have a logo. I was quite disappointed. I'm like searching for a Pelican logo and find one. They really need a logo. This Pelican is very similar to Nikila. But the development is not as strong. It doesn't have as much features and stuff, but some people like it. Hugo. I've actually been doing quite a bit with Hugo lately. It's written in Go. I'm blown away by how fast it is. It can just generate a site like that. You could give it like 200 pages and it just processes it immediately. It's incredible. Also the metadata can be defiled in YAML and JSON and such. So it has a bit more flexibility in the metadata. It's really easy to install as well. Nikila has been quite hard to install in the past, but Hugo is quite easy. You can just apt-get and install Hugo and don't have to worry about any dependencies. So Nikila. It's named after Nikila Tesla. He's quite the geek. He invented quite a few things like the fluorescent lighting, Tesla, induction motor and the coil and AC, amongst other things. He's very much underrepresented, I feel. So all about representing Nikila. This is Rob Beater. He's the creator of Nikila. He's still developing it today. He's the lead developer on it. There's quite a few other people that also work on it. He originally got into Python by writing Python bindings for X-Forms. He was doing lots of network admin. Last time I heard he was working for Canonical. He's in Argentina. I'm not sure if he's still working for Canonical or not. He's very friendly. You can send him emails and talk to him on the mailing list and stuff like that. Great guy. So Nikila is a static website and blog generator. Basically, he takes some text and creates a folder of HTML files and then with the output that it creates, you can upload it to your web server. It's a fully-featured website. The original goal of Nikila was to create blogs, especially technical blogs for people. Some stats on GitHub. This was started a week or so ago. It's probably a bit more than this now. 8,700 commits and 76 releases and about 160 contributors. It's licensed under MIT. It's got 57 closed issues and 1,600 issues closed. It's been in development since March 2012. Installing Nikila, they recommend to have Python 3.3 or higher. They actually recently dropped support for Python 2.7 partially. They still support it a little bit, but they really recommend using Python 3, which is good. And, of course, they recommend using virtual environment and running it under that. You can pull the markup languages. It supports a range of languages. You can write your files in Markdown or RST. It supports Jupyter Notebooks, which I'm quite the fan of Jupyter Notebooks. I've been using them for years. That's one thing that really appealed to me with Nikila was the fact I could just give it my notebooks and it would build websites out of my notebooks. Here's some commands. To create a website, in the terminal, you would just type Nikila in it. To do a new post, this new post. You could also do a new page or create a new page. And Nikila build creates the output folder. If you want to run the web server, Nikila serve, of course, that's not recommended on production. You'll be able to use Apache on Injects. You could also import your WordPress website. This is the command I run when I talk to my art website and turn it into a Nikila site. So, yeah, just Nikila and Port WordPress. Just give it the XML and it does the rest. The kind of the structure for Nikila website. So you do, like, Nikila in it and say, you have my awesome site. And you've got a gallery's folder. So you put your images in there. There's a posts folder. It's where you put your blog posts. You've got pages. It's where you put your files that don't show up on the timeline. Say you had, like, an about page or something like that. That's where you would put it. You've got themes. I'll get into that a bit later, a bit more, but that's where you could put various themes. Okay, so you've got your, in there as well, you've also got your config.py folder. So it's your config for the Nikila site. It's got options for your site title, URL, author, time zone. You can put your Creative Commons license in there or render that license and such. You can specify the types of files that you wanted to process. So you only wanted it to process markdown or RST files. You could type that in and you could also, like, specify the pages that you want processed. There's lots more options in the Comfort file. Metafiles, they look like this. So you can choose to have your metafiles separate from, like, say, your markdown files or you can have it in one. Personally, I like having them separately, but it's totally up to you. So you have a title, you have a slug, the date, you can have tags, the link in description and the type. Some of them are optional. The ones you only really need is the title, the slug, and the date. The others are all kind of optional. You've got plugins. This is the URL here for plugins for Nikila. So one of them, for example, is a JSON feed to generate a JSON feed for your Nikila blog. Plugins basically are just a .plugin and a .py file. This is an example of helloworld.plugin, quite a simple example for this. So you've got your name, the module, tests, and some documentation, like author and version, website, description and such. This is what the helloworld Python file would look like for the plugin. So you're importing from the Nikila library because you can just do, like, an import Nikila and work with Nikila in a Python file of it. And then you've got this, and yeah, it's that. I'm doing some logging. We've got this ifbylogger.noticebyworld else helloworld. So yeah, that's an example. You've got themes. These are the limited range of themes. They don't really have many designers working on the project, but they've got bootstrap themes, which kind of just work fine. My site is just kind of a default bootstrap theme. But I do, like, you can put, like, a logo on it and such, replace the default text with a logo, which adds some clear to it. There could be more, like, I think Hugo's got it really good. They've got a huge range of themes and such. This is an example of a couple of the themes that they have on the Nikila website. So there's a few there to choose from. Okay, do it. They were having issues with Nikila a few years ago where it would take, like, an hour and a half to process the website and that. So they started, so they used this Python library called doit, which speed up the process much faster than that. So it only processes the stuff that's been changed and stuff. This is an example of, like, a simple do-it script. So you would save this as a Python file and then just run, like, in the command line, doit.hello.py and it would run this. Coil, CMS, they've developed for CMS manager for Nikila so that you don't have to use the command line. You can, like, open up the web browser and do it through the web browser. So it's actually powered by Flask. They've got a demo online and stuff and, like, the codes will be there. Personally, myself, I've never used it and I'm quite happy with, like, command line or, like, writing scripts to process my websites. One of the scripts I have written is artsy gallery. I use this to, like, process my blog posts. So I basically have a folder of my artwork and I have a config file and in the config file I specify, like, the name of the blog post, the folder where my images are and, yeah, and then I just run the script and it processes it and basically takes all those images and creates a markdown file out of it and asks me for, like, comments on each piece of my artwork as it goes through. So, yeah, I've been working on that for a while and I've also been, instead of using the date-time library, I use the aero library. It's quite wonderful if you guys want to check out the aero library. It can do some quite cool stuff, like, humanize date and time. So it can say, like, ah, this was an hour ago. It's quite a neat feature. Okay. I've got another script with Nikila called meme generator. This is very similar to my artsy gallery, but it generates memes. It's config file where you give it, like, the meme title, the top text and bottom text in the user and it basically grabs that meme name from a folder of images and generates the meme with the top text and bottom text. It doesn't do water marks, which really frustrates me, like, in examples and stuff like that, when people show their memes in that, they've got the water marks on them. So there's some examples of some Nikila sites. So my own site, artcontrol.me. One that popped up recently was colorofcosmos.com. There's some quite beautiful, like, space photography and such, which is really nice. WX Python uses it. And Peter Rootman from Wacka University, he's been using it quite a bit. I'd be quite happy because I've done this talk at the Hamilton Python user group in the past and got Peter using it. And he even used it for, like, one of the conferences, the machine learning conference that they had on at Wacka University. So it's just, like, yeah, they start, like, actually using, like, really good, like, Python libraries like Nikila. Okay. That's all. I can do a demo though. I've probably got heaps of time left. But that's all on the slides. Yeah, sure. So this is that. So it's a logo there. You can see real flash. This was from an actually art gallery in Sydney I recently went to. Most of these aren't actually mine. Oh, that's my, it's my Adam Place fountain. So you might remember the Matrix, the girl in the red dress. Quite famous. So that's the site. So quite basic. I can also show you, I can do a, I'll do a demo of Nikila. So you can just type Nikila in like this. So it's making you new, new, new website. So destination, home, pie, the nearest, like, title, so-called Kiwi, Picon 2017. Also William. Let's give it default on that. Okay. So that will be in there now. So we can go in here. So you can see is that Confit class talking about before you got the galleries, posts, stories. They're actually supposed to be switching across from stories to pages. Pages sounds so much better than stories. But it doesn't matter. We're doing, we're doing new posts. So you can see that's the metadata over there. And we just edit this. Save that. And then we can run Nikila build takes a minute. It's creating the output folder. So if we go back there, you can see now there's the output folder. So we can just do Nikila serve. I think it runs on port 8,000. Yeah. So local host, port 8,000. So there we go. Just like that. None as fast as here go. But yeah, they've got, you've got archive, oh, you mean not archives? Navigation links? Oh, yeah, you can just hit the title screen at the top. Oh, it would take me to example.com. Yeah. Yeah, you could, you could do it. Yeah, well, you could just type links into your markup. Yeah, like if you wanted to link to like any website or anything like that, your previous blog posts, you would just put that in your map, not down far. Yeah, like kind of like template thing. Yeah, yeah, but you could, you could do it. Yeah, as well. Yeah, especially if you're like generating that, that markdown and stuff. So it would like generate a certain, like certain content on the markdown file, which I may, and then you would just add to it. That what you mean? I also use it for this for my main generator. I'm sorry, the text is really small. But if someone can yell out a meme that they like, a meme, hey, anyone? Grumpy cat? Okay. So we put that in the meme name. And I need the top text for Grumpy Cat. Don't know what ones. Hey, and bottom text would rather use Python. I don't know if you mail. We just save that probably wait about 10 seconds. I've a script that's like, that runs every 10 seconds. It checks, it checks to see if this file is being changed. And if it's being changed, then it runs beyond here. So, so that's, that's, that's running on the killer. So it built in that time when I wrote it and stuff like that built in killer site. I'll bring up the plugin website. Like one of the plugins for like, say you're like importing from various different sources, like that import WordPress was actually a plugin. This is them all here, all the available plugins. Oh, sorry, the text is small. It's better. So those are all the import ones. It can compile IRC logs and stuff like the killer site. It has like all the archives of like the killer IRC on the website. And so yeah, they'll use that for, for the site. I actually don't use any plugins myself. They can be malicious. Like you could do it. Yeah. Yeah. Well, it just, it just allows you to, to, to write plugins and stuff. Hey, yeah, absolutely. I don't think there's anything out there like it for it yet. You might have to work on it, Richard. It's a feature request day for them. So yeah, there's a lot of, a lot of plugins there. Any more questions? Yes, I'll show you. I can show you what it looks like. It's you, you're basically in giving it as you don't need a plugin for it. Actually, you can just give it your like I Python notebook and then the metadata that goes with it and it generates, it generates it. You just give it your IP, your, your, your notebook. You kind of need to give it like, well, you could like download it to like say if you downloaded the notebook to like your local thing from your GitHub and then process it through that might be easier. I don't know about processing it directly on GitHub, but sorry to say that again. Yeah, yeah, yeah. And this is what it looks like. Like, I Python notebook as in the killer website. They're quite similar to just like the markdown and stuff except it is, it is a notebook. Absolutely. Yeah, yeah, you can, and they accept new themes and stuff. If you develop a new theme and stuff and want to share a theme, they'll, they'll add it to the repository and they're quite desperate for new themes. Yeah, yeah, the, the themes and yeah, nothing, nothing too special here. Only changes like what you change, what, what, what you change. That's worth a dollar. Yeah, it keeps track of like what you've changed and stuff like that. Yeah. Well, you've got your output here. So you could, you could do put that wherever you wanted. You could, oh, like you could just ask Lincoln if you wanted to, but they actually do have like deploy commands. I haven't had a good play with them, but this is a config file I was telling about before the autism default. Are they support languages? They're pretty good about supporting different languages and translation, translations. It's a, it's the navigation links. That's what you're talking about before, was it? Navigation links? Like at the top of the bar? That's it there. So you just edit the config file and you could just put them whatever you wanted there. And that's where you change the theme as well. It's time zone. Go down. That's a post like if you wanted to do I Python notebooks, you would change it from that or add it in. And then that would support I Python notebooks. You can also get rid of, you can turn it from rather than it's serving it as a blog, you could just turn it serving as pages and stuff, get rid of the whole blog thing and actually just show like a page when you first go to the website. Good if you're like, yeah, if you just want it rather than showing over just a normal page. That's the compilers, the different compilers that it supports. One file posts. I quite often turn that on. If you don't want the separate or metadata, if you just want one file, you're talking about the deploying, there's the logo URL. I haven't answered the deploying thing yet. I'm sure there's an option in here about like a command that it would run when you, here you go, commands to execute to deploy. So you can deploy commands so, yeah. Yeah, you can sync it to like GitHub or wherever you want. Yeah, yeah. Then there's the, you know, I've got options for GitHub source as well if you wanted to put it up at the point to GitHub and stuff. Output folder if you wanted to change it from output to something different. Sess, put sess, galleries. Yeah, I showed you galleries a little bit. Yeah, options to change gallery settings. There's no idea what some of those things are. Fave icon. Oh, that's three more. License, so you can put your Creative Commons license if you want. And content footer, you can change that if you want to change whatever's on your footer. Comments system, you can change your comments system. Yes. It can be quite hard to like move from other things, like if, because you can't, not come hard to move from say like, Nikila to Hugo sometimes. Like, well, if your site was in WordPress, you might be able to import it into Hugo much easier. Stuff like that maybe. Yeah. You should definitely look at static site generator rather than writing HTML. Especially because you could put it as a notebook in the array. So it will render your code quite beautifully. It's all mobile friendly. Yeah. There you go. It would look great on mobile. Site map.xml here. You got this. Here's the site map.xml. Oh, it's search. Yeah, I think it's possible to put a search button in it. But you've got archives as well. Yeah, you could put a search in it. It would have, do no evil. Do no evil. They got rid of that though. On the side, eh? Yeah. See, I saw, I saw my images by month and then day, or year month day. What keynote was that? KiwiCon. Yeah. They're all there. Any more questions? Kind of done, eh? But early. Previously when I've done this talk, it's finished in 15 minutes. So I think I've done pretty well. Keep on going. Thank you.