-
Notifications
You must be signed in to change notification settings - Fork 458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
change all instances of 'story' to 'page' #2518
Changes from 1 commit
2dfe792
dbbd09a
b791b9d
5096052
bf0c579
14159b3
55379f7
0c736cf
477af6c
f654856
d2caa70
8a89838
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -394,7 +394,7 @@ template | |
|
||
.. code:: restructuredtext | ||
|
||
.. template: story.tmpl | ||
.. template: page.tmpl | ||
|
||
To add these metadata fields to all new posts by default, you can set the | ||
variable ``ADDITIONAL_METADATA`` in your configuration. For example, you can | ||
|
@@ -508,15 +508,15 @@ options. The exact mechanism is explained above the config options in the | |
("posts/*.html", "posts", "post.tmpl"), | ||
) | ||
PAGES = ( | ||
("stories/*.rst", "stories", "story.tmpl"), | ||
("stories/*.txt", "stories", "story.tmpl"), | ||
("stories/*.html", "stories", "story.tmpl"), | ||
("pages/*.rst", "pages", "page.tmpl"), | ||
("pages/*.txt", "pages", "page.tmpl"), | ||
("pages/*.html", "pages", "page.tmpl"), | ||
) | ||
|
||
.. note:: POSTS and PAGES are not flat! | ||
|
||
Even if the syntax may suggest you can't, you can create any directory structure you want | ||
inside ``posts/`` or ``stories/`` and it will be reflected in the output. For example, | ||
inside ``posts/`` or ``pages/`` and it will be reflected in the output. For example, | ||
``posts/foo/bar.txt`` would produce ``output/posts/foo/bar.html``, assuming the slug is also ``bar``. | ||
|
||
If you have ``PRETTY_URLS`` enabled, that would be ``output/posts/foo/bar/index.html``. | ||
|
@@ -815,26 +815,22 @@ There are multiple configuration variables dedicated to each of the three taxono | |
* ``HIDDEN_TAGS``. ``HIDDEN_CATEGORIES`` to make some tags/categories invisible in lists | ||
* ``POSTS_SECTION_FROM_META`` to use ``.. section:`` in posts instead of inferring paths from paths | ||
|
||
Creating a Page (Story) | ||
Creating a Page | ||
----------------------- | ||
|
||
Pages are the same as posts, except that: | ||
|
||
* They are not added to the front page | ||
* They don't appear on the RSS feed | ||
* They use the ``story.tmpl`` template instead of ``post.tmpl`` by default | ||
* They use the ``page.tmpl`` template instead of ``post.tmpl`` by default | ||
|
||
The default configuration expects the page's metadata and text files to be on the | ||
``stories`` folder, but that can be changed (see ``PAGES`` option above). | ||
``pages`` folder, but that can be changed (see ``PAGES`` option above). | ||
|
||
You can create the page's files manually or use the ``new_post`` command | ||
with the ``-p`` option, which will place the files in the folder that | ||
has ``use_in_feed`` set to False. | ||
|
||
In some places (including default directories and templates), pages are called | ||
*stories* for historic reasons. Both are synonyms for the same thing: pages | ||
that are not blog posts. | ||
|
||
Supported input formats | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’d prefer this explainer to be left in. |
||
----------------------- | ||
|
||
|
@@ -2342,7 +2338,7 @@ the template file in Nikola's base theme for an example of how this works. | |
The list may fail to update in some cases, please run ``nikola build -a`` with | ||
the appropriate path if this happens. | ||
|
||
We recommend using stories with dates in the past (1970-01-01) to avoid | ||
We recommend using pages with dates in the past (1970-01-01) to avoid | ||
dependency issues. | ||
|
||
If you are using this as a shortcode, flags (``reverse``, ``all``) are meant to be used | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,185 @@ | ||
../creating-a-site.txt | ||
.. slug: creating-a-site-not-a-blog-with-nikola | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your git client seems to have broken symlinks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm on Windows. How do I fix that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can’t; we will if we go ahead with this. |
||
.. date: 2015-01-10 10:00:00 UTC | ||
.. tags: nikola, python | ||
.. link: | ||
.. description: | ||
.. title: Creating a Site (Not a Blog) with Nikola | ||
.. author: The Nikola Team | ||
|
||
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 ;-) | ||
|
||
Since it started, Nikola has had the capabilities to create generic sites. For example, | ||
Nikola’s `own site <https://getnikola.com/>`_ is a fairly generic one. Let’s 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 (mostly) configured site: | ||
|
||
.. code:: console | ||
|
||
$ nikola init 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: | ||
|
||
.. code:: python | ||
|
||
# Data about this site | ||
BLOG_AUTHOR = "Roberto Alsina" | ||
BLOG_TITLE = "Not a Blog" | ||
# This is the main URL for your site. It will be used | ||
# in a prominent link | ||
SITE_URL = "https://getnikola.com/" | ||
BLOG_EMAIL = "ralsina@example.com" | ||
BLOG_DESCRIPTION = "This is a demo site (not a blog) for Nikola." | ||
|
||
# | ||
# Some things in the middle you don't really need to change... | ||
# | ||
|
||
POSTS = () | ||
# you can also keep the current content of POSTS if you want a blog with your site | ||
PAGES = ( | ||
("pages/*.rst", "", "page.tmpl"), | ||
("pages/*.txt", "", "page.tmpl"), | ||
("pages/*.html", "", "page.tmpl"), | ||
) | ||
|
||
# And to avoid a conflict because blogs try to generate /index.html | ||
INDEX_PATH = "blog" | ||
|
||
|
||
And now we are ready to create our first page: | ||
|
||
.. code:: console | ||
|
||
$ nikola new_page | ||
Creating New Page | ||
----------------- | ||
|
||
Title: index | ||
Scanning posts....done! | ||
[1970-01-01T00:00:00Z] INFO: new_page: Your page's text is at: pages/index.rst | ||
|
||
We can now build and preview our site: | ||
|
||
.. code:: console | ||
|
||
$ nikola build | ||
Scanning posts.done! | ||
. render_site:output/categories/index.html | ||
. render_sources:output/index.txt | ||
. render_rss:output/rss.xml | ||
⋮ | ||
$ nikola serve | ||
[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/ | ||
|
||
So, what’s in that ``pages/index.txt`` file? | ||
|
||
.. code:: rest | ||
|
||
.. title: index | ||
.. slug: index | ||
.. 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``). ``date``, ``tags`` and ``link`` | ||
doesn’t matter at all in pages. ``description`` is useful for SEO purposes | ||
if you care for that. | ||
|
||
And below, the content. By default Nikola uses | ||
`reStructuredText <https://getnikola.com/quickstart.html>`_ but it supports | ||
a ton of formats, including Markdown, plain HTML, Jupyter Notebooks, BBCode, | ||
Wiki, and Textile. We will use reStructuredText for this example, but some | ||
people might find it a bit too limiting — if that is the case, try using HTML | ||
for your pages (Nikola does this on the index page, for example). | ||
|
||
So, let's give the page a nicer title, and some fake content. Since the default | ||
Nikola theme (called ``bootstrap3``) is based on `Bootstrap <http://getbootstrap.com/>`_ | ||
you can use anything you like from it: | ||
|
||
.. code:: rest | ||
|
||
.. title: Welcome To The Fake Site | ||
.. slug: index | ||
.. date: 1970-01-01 00:00:00 UTC | ||
.. tags: | ||
.. link: | ||
.. description: Fake Site version 1, welcome page! | ||
|
||
|
||
.. class:: jumbotron col-md-6 | ||
|
||
.. admonition:: This is a Fake Site | ||
|
||
It pretends to be about things, but is really just an example. | ||
|
||
.. raw:: html | ||
|
||
<a href="https://getnikola.com/" class="btn btn-primary btn-lg">Click Me!</a> | ||
|
||
|
||
.. class:: col-md-5 | ||
|
||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris non nunc turpis. | ||
Phasellus a ullamcorper leo. Sed fringilla dapibus orci eu ornare. Quisque | ||
gravida quam a mi dignissim consequat. Morbi sed iaculis mi. Vivamus ultrices | ||
mattis euismod. Mauris aliquet magna eget mauris volutpat a egestas leo rhoncus. | ||
In hac habitasse platea dictumst. Ut sed mi arcu. Nullam id massa eu orci | ||
convallis accumsan. Nunc faucibus sodales justo ac ornare. In eu congue eros. | ||
Pellentesque iaculis risus urna. Proin est lorem, scelerisque non elementum at, | ||
semper vel velit. Phasellus consectetur orci vel tortor tempus imperdiet. Class | ||
aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos | ||
himenaeos. | ||
|
||
.. admonition:: TIP: Nice URLs | ||
|
||
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 | ||
(on by default) | ||
|
||
And that's it. You will want to change the NAVIGATION_LINKS option to create a reasonable | ||
menu for your site, you may 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. | ||
|
||
.. admonition:: TIP: So, how do I add a blog now? | ||
|
||
First, change the ``POSTS`` option like this: | ||
|
||
.. code:: python | ||
|
||
POSTS = ( | ||
("posts/*.rst", "blog", "post.tmpl"), | ||
("posts/*.txt", "blog", "post.tmpl"), | ||
("posts/*.html", "blog", "post.tmpl"), | ||
) | ||
|
||
Create a post with ``nikola new_post`` and that's it, you now have a blog | ||
in the ``/blog/`` subdirectory of your site — you may want to link to | ||
it in ``NAVIGATION_LINKS``. | ||
|
||
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! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Underline needs to match new title length.