This is a continuation of Last time.
Last time I posted a blog using Nikola's default formats, reStructuredText and Markdown. This time I will post a blog using ipynb format (Jupyter Notebook).
Edit conf.py directly under the site directory. Add an entry with the extension ʻipynb`.
conf.py
POSTS = (
("posts/*.rst", "posts", "post.tmpl"),
("posts/*.md", "posts", "post.tmpl"),
("posts/*.txt", "posts", "post.tmpl"),
("posts/*.html", "posts", "post.tmpl"),
)
PAGES = (
("pages/*.rst", "pages", "page.tmpl"),
("pages/*.md", "pages", "page.tmpl"),
("pages/*.txt", "pages", "page.tmpl"),
("pages/*.html", "pages", "page.tmpl"),
)
conf.py
POSTS = (
("posts/*.rst", "posts", "post.tmpl"),
("posts/*.md", "posts", "post.tmpl"),
("posts/*.txt", "posts", "post.tmpl"),
("posts/*.html", "posts", "post.tmpl"),
("posts/*.ipynb", "posts", "post.tmpl"),
)
PAGES = (
("pages/*.rst", "pages", "page.tmpl"),
("pages/*.md", "pages", "page.tmpl"),
("pages/*.txt", "pages", "page.tmpl"),
("pages/*.html", "pages", "page.tmpl"),
("pages/*.ipynb", "pages", "page.tmpl"),
)
Execute the following command.
nikola new_post -f ipynb
Creating New Post
-----------------
Title:
Entering the title of the article will generate a post / titlename.ipynb file. Edit this file on Jupyter.
The build is the same as last time.
nikola build
nikola serve -b
It will be posted like this.
site directory / post
.menu bar --Edit --Edit Notebook Metadata
from the Jupyter Notebook and add an entry like the one below. " nikola ":
is fixed, and the title etc. will be changed according to the article. "nikola": {
"tags": "",
"title": "post4",
"date": "2017-06-17 15:15:00 UTC+09:00",
"type": "text",
"slug": "post4",
"category": "",
"link": "",
"description": ""
}
nikola build
nikola serve -b
In this way, you can post as a blog post just by adding the notebook metadata.
Recommended Posts