Skip to content
Permalink
Browse files

fix #1574 -- update not-a-blog docs

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Jan 10, 2015
1 parent 73f7db8 commit a365bc441c2cb589f4ff07d1eec66161896ba221
Showing with 30 additions and 28 deletions.
  1. +30 −28 docs/creating-a-site.txt
@@ -10,19 +10,22 @@ Creating a Site (Not a Blog) with Nikola

.. class:: lead

One of the most frequent questions I get about Nikola is "but how do
I create a site that's not a blog?". And of course, that's because the
documentation is heavily blog-oriented. This document will change that ;-)
One of the most frequent questions I get about Nikola is but how do
I create a site thats not a blog?. And of course, thats because the
documentation is heavily blogoriented. This document will change that ;-)

Since it started, Nikola has had the capabilities to create generic sites. For example,
Nikola's `own site <http://getnikola.com>`_ is a fairly generic one. Let's go
Nikolas `own site <https://getnikola.com/>`_ is a fairly generic one. Lets go
step by step on how you can do something like that.

As usual when starting a nikola site, you start with ``nikola init`` which creates a
empty semi-configured site::
empty (mostly) configured site::

$ nikola init mysite
Created empty site at mysite.
Creating Nikola Site
====================
[1970-01-01T00:00:00Z] INFO: init: Created empty site at mysite.

Then we go into the new ``mysite`` folder, and make the needed changes in the ``conf.py``
configuration file:
@@ -40,8 +43,8 @@ configuration file:
BLOG_TITLE = "Not a Blog"
# This is the main URL for your site. It will be used
# in a prominent link
SITE_URL = "http://notablog.ralsina.com.ar/"
BLOG_EMAIL = "ralsina@kde.org"
SITE_URL = "http://getnikola.com/"
BLOG_EMAIL = "ralsina@example.com"
BLOG_DESCRIPTION = "This is a demo site (not a blog) for Nikola."

#
@@ -58,8 +61,8 @@ configuration file:

And now we are ready to create our first page::

$ nikola new_post -p
Creating New Post
$ nikola new_page
Creating New Page
-----------------

Enter title: index
@@ -74,32 +77,30 @@ We can now build and preview our site::
. render_site:output/categories/index.html
. render_sources:output/index.txt
. render_rss:output/rss.xml
:
:
: [Much more of the same]

$ nikola serve
Serving HTTP on 127.0.0.1 port 8000 ...
[1970-01-01T00:00:00Z] INFO: serve: Serving HTTP on 0.0.0.0 port 8000...


And you can see your (very empty) site in http://localhost:8000
And you can see your (very empty) site in http://localhost:8000/

So, what's in that ``pages/index.txt`` file?
So, whats in that ``pages/index.txt`` file?

.. code-block:: rest

.. title: index
.. slug: index
.. date: 2013/03/01 10:26:17
.. date: 1970-01-01 00:00:00 UTC
.. tags:
.. link:
.. description:


Write your post here.

Title is the page title, slug is the name of the generated HTML file
(in this case it would be ``index.html``) the date doesn't matter much in
not-blogs, same for tags and link. Description is useful for SEO purposes
``title`` is the page title, ``slug`` is the name of the generated HTML file
(in this case it would be ``index.html``). ``date``, ``tags`` and ``link``
doesn’t matter at all in stories. ``description`` is useful for SEO purposes
if you care for that.

And below, the content. By default you are expected to use
@@ -108,7 +109,7 @@ Nikola supports a ton of formats, including Markdown, plain HTML, BBCode,
Wiki, and Textile.

So, let's give the page a nicer title, and some fake content. Since the default
Nikola theme (called "bootstrap") is based on `bootstrap 2 <http://getbootstrap.com/2.3.2/>`_
Nikola theme (called ``bootstrap3``) is based on `Bootstrap <http://getbootstrap.com/>`_
you can use anything you like from it:

.. code-block:: rest
@@ -121,7 +122,7 @@ you can use anything you like from it:
.. description: Fake Site version 1, welcome page!


.. class:: hero-unit span6
.. class:: jumbotron span6

.. admonition:: This is a Fake Site

@@ -150,11 +151,11 @@ you can use anything you like from it:

.. admonition:: TIP: Nice URLs

If you like your URLs without the ".html" then you want to create folders and
If you like your URLs without the ``.html`` then you want to create folders and
put the pages in ``index.html`` inside them using the ``PRETTY_URLS`` option.

And that's it. You will want to change the NAVIGATION_LINKS option to create a reasonable
"menu" for your site, you will want to hack the theme (check ``nikola help bootswatch_theme``
menu for your site, you will want to modify the theme (check ``nikola help bootswatch_theme``
for a quick & dirty solution), and you may want to add a blog later on, for company news
or whatever.

@@ -167,9 +168,10 @@ or whatever.
POSTS = [("posts/*.txt", "blog", "post.tmpl", True)]

Create a post with ``nikola new_post`` and that's it, you now have a blog
in http://yoursite.com/blog (you may want to add links to it in NAVIGATION_LINKS of course).
in the ``/blog/`` subdirectory of your site — you may want to link to
it in ``NAVIGATION_LINKS``.

You can see the finished site in http://notablog.ralsina.com.ar and its full configuration in
http://ralsina.me/listings/notablog/conf.py.html
If you want to see a site implementing all of the above, check out `the Nikola
website <https://getnikola.com/>`_.

I hope this was helpful!

0 comments on commit a365bc4

Please sign in to comment.