Creating a site (not a blog) and get directory listing

54 views
Skip to first unread message

Greg Nordin

unread,
Sep 28, 2016, 2:57:22 AM9/28/16
to nikola-discuss
I followed the instructions exactly at https://getnikola.com/creating-a-site-not-a-blog-with-nikola.html to create a site (not a blog). After executing the first `nikola serve` command, I just get a listing of the directories in `output`. If I click on `stories` I get the expected index.html file created by the new_post command. How do I get this index.html file to show up as the main index.html file for the entire site, which is what I thought was supposed to happen by following these directions?

Roberto Alsina

unread,
Sep 28, 2016, 6:54:04 AM9/28/16
to nikola-discuss
That probably means you skipped a step.Check your conf.py and make sure PAGES looks like this:

PAGES = (
    ("stories/*.rst", "", "story.tmpl"),
    ("stories/*.txt", "", "story.tmpl"),
    ("stories/*.html", "", "story.tmpl"),
)


On Wed, Sep 28, 2016 at 3:57 AM Greg Nordin <nordi...@gmail.com> wrote:
I followed the instructions exactly at https://getnikola.com/creating-a-site-not-a-blog-with-nikola.html to create a site (not a blog). After executing the first `nikola serve` command, I just get a listing of the directories in `output`. If I click on `stories` I get the expected index.html file created by the new_post command. How do I get this index.html file to show up as the main index.html file for the entire site, which is what I thought was supposed to happen by following these directions?

--
You received this message because you are subscribed to the Google Groups "nikola-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nikola-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Greg Nordin

unread,
Sep 28, 2016, 10:06:49 AM9/28/16
to nikola-discuss, ral...@kde.org
Ahh, my mistake was missing the fact that a line in the PAGES definition should look like

    ("stories/*.rst", "", "story.tmpl")

instead of 

    ("stories/*.rst", "stories", "story.tmpl")

as in the default definition. Thank you very much for your help!

Greg Nordin

unread,
Sep 28, 2016, 10:18:10 AM9/28/16
to nikola-discuss
This brings up a new question. Since the destination for all new_pages is now "", each new page will result in a corresponding new directory inside `output` after building the site. If I have lots of pages, this will clutter up the `output` directory. I would prefer all new pages be put in some other directory like the default `stories`. Is it possible to do this, i.e., have the index.html file end up in `output`, but all other pages end up in `stories`? 

Roberto Alsina

unread,
Sep 28, 2016, 10:35:43 AM9/28/16
to nikola-discuss
You'd have to have two different lines in PAGES, like:

PAGES=[
("root/*.txt", "", "story.tmpl"),
("stories/*.txt", "stories", "story.tmpl"),
]

Then everything in root/whatever.txt will be in the root folder, everything else in stories/

--

Roberto Alsina

unread,
Sep 28, 2016, 10:44:57 AM9/28/16
to nikola-discuss
Alternatively, just put things in folders. The folder structure you use is reflected in output.

Greg Nordin

unread,
Sep 29, 2016, 1:58:38 AM9/29/16
to nikola-discuss, ral...@kde.org
Thanks, Roberto. I tried this out and have a further question. When I use `nikola new_page`, it always places the new page in root and never sees the second line of the definition below. This is fine for index.md (I'm using markdown), but not if I want a new page to be placed in stories. Is there a way to force this with `nikola new_page`, or can I just create a new page in a text editor and place it where I want it (i.e., stories) and `nikola build` will take care of things. I guess I don't understand if there is anything special that `nikola new_post` does other than creating a new file in a particular place.

Chris Warrick

unread,
Sep 29, 2016, 3:07:23 AM9/29/16
to Nikola—Discuss

On 29 Sep 2016 07:58, "Greg Nordin" <nordi...@gmail.com> wrote:
>
> Thanks, Roberto. I tried this out and have a further question. When I use `nikola new_page`, it always places the new page in root and never sees the second line of the definition below. This is fine for index.md (I'm using markdown), but not if I want a new page to be placed in stories. Is there a way to force this with `nikola new_page`, or can I just create a new page in a text editor and place it where I want it (i.e., stories) and `nikola build` will take care of things. I guess I don't understand if there is anything special that `nikola new_post` does other than creating a new file in a particular place.

The commands take an optional argument at the end that let you specify the destination path. However, if you're more likely to put pages in stories, just rearrange PAGES to list stories/ before root/.

The commands don't do anything special, they just create the right meta data for you automatically. You're free to create those files manually if you remember what they should say at the top.

--
Chris Warrick <https://chriswarrick.com/>

Greg Nordin

unread,
Sep 30, 2016, 1:11:55 AM9/30/16
to nikola-discuss
Thanks, Chris--this was very helpful!
Reply all
Reply to author
Forward
0 new messages