demo: add blog based on Jupyter notebook

This commit is contained in:
George Cushen committed 2019-02-05 11:43:16 +00:00
1 parent 2838919415
commit 066e7ebcfb
6 files changed
+248 -2

No files matched your search

+1 -1
View File
@@ -39,7 +39,7 @@ defaultContentLanguageInSubdir = false
paginate = 10 # Number of items per page in paginated lists.
enableEmoji = true
footnotereturnlinkcontents = "<sup>^</sup>"
ignoreFiles = ["\\.Rmd$", "\\.Rmarkdown$", "_files$", "_cache$"]
ignoreFiles = ["\\.ipynb$", ".ipynb_checkpoints$", "\\.Rmd$", "\\.Rmarkdown$", "_files$", "_cache$"]
preserveTaxonomyNames = true
[outputs]
+1 -1
View File
@@ -142,7 +142,7 @@ sharing = true
# 3: Card
# 4: Citation (publications only)
post_view = 2
publication_view = 4
publication_view = 2
talk_view = 2
# Search.
@@ -0,0 +1,148 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlkAAADLCAYAAABdyYYmAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAABZ0RVh0Q3JlYXRpb24gVGltZQAwNi8wNS8wNE2+5nEAAAAldEVYdFNvZnR3YXJlAE1hY3JvbWVkaWEgRmlyZXdvcmtzIE1YIDIwMDSHdqzPAAAgAElEQVR4nO3df4wb14Ef8K8U2TJHPyyZG9tra9SzHXESXNKQcpKeKdTORVSCwtm93B/XVVLgEPbiBpCApEFXV6NANo1yRdXzormiWF1aO6GAtlfvFW1SblXk4t00daJxfjQic3GQzMq/ItpexdnRr5VIWbI1/YM73OFwfrwhZ4Yc7vcD2OQM37x53F0tv/vemzcbDMMwQERERESh2tjvBhARERENI4YsIiIioggwZBERERFFgCGLiIiIKAIMWUREREQRYMgiIiIiigBDFhEREVEEGLKIiIiIIsCQRURERBQBhiwiIiKiCDBkEREREUWAIYuIiIgoAgxZRERERBFgyCIiIiKKAEMWERERUQQYsoiIiIgiwJBFREREFAGGL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0bJkM/ncezYMRw6dMg3YFmlUikLine truncated
"text/plain": [
"<IPython.core.display.Image object>"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from IPython.core.display import Image\n",
"Image('https://www.python.org/static/community_logos/python-logo-master-v3-TM-flattened.png')"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Welcome to Academic!\n"
]
}
],
"source": [
"print(\"Welcome to Academic!\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Install Python and Jupyter\n",
"\n",
"[Install Anaconda](https://www.anaconda.com/distribution/#download-section) which includes Python 3 and Jupyter notebook.\n",
"\n",
"Otherwise, for advanced users, install Jupyter notebook with `pip3 install jupyter`."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Create a new blog post [as usual](https://sourcethemes.com/academic/docs/managing-content/#create-a-blog-post)\n",
"\n",
"Run the following commands in your Terminal, substituting `<MY_WEBSITE_FOLDER>` and `my-post` with the file path to your Academic website folder and a name for your blog post (without spaces), respectively: "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"```bash\n",
"cd <MY_WEBSITE_FOLDER>\n",
"hugo new --kind post post/my-post\n",
"cd <MY_WEBSITE_FOLDER>/content/post/my-post/\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Create or upload a Jupyter notebook\n",
"\n",
"Run the following command to start Jupyter within your new blog post folder. Then create a new Jupyter notebook (*New > Python Notebook*) or upload a notebook."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"```bash\n",
"jupyter notebook\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Convert notebook to Markdown"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"```bash\n",
"jupyter nbconvert Untitled.ipynb --to markdown --NbConvertApp.output_files_dir=.\n",
"\n",
"# Copy the contents of Untitled.md and append it to index.md:\n",
"cat Untitled.md | tee -a index.md\n",
"\n",
"# Remove the temporary file:\n",
"rm Untitled.md\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Edit your post metadata\n",
"\n",
"Open `index.md` in your text editor and edit the title etc. in the [front matter](https://sourcethemes.com/academic/docs/front-matter/) according to your preference.\n",
"\n",
"To set a [featured image](https://sourcethemes.com/academic/docs/managing-content/#featured-image), place an image named `featured` into your post's folder.\n",
"\n",
"For other tips, such as using math, see the guide on [writing content with Academic](https://sourcethemes.com/academic/docs/writing-markdown-latex/). "
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

+98
View File
@@ -0,0 +1,98 @@
+++
title = "Display Jupyter Notebooks with Academic"
subtitle = "Learn how to blog in Academic using Jupyter notebooks"
summary = "Learn how to blog in Academic using Jupyter notebooks"
date = 2019-02-05T00:00:00Z
draft = false
# Authors. Comma separated list, e.g. `["Bob Smith", "David Jones"]`.
authors = ["Admin"]
# Tags and categories
# For example, use `tags = []` for no tags, or the form `tags = ["A Tag", "Another Tag"]` for one or more tags.
tags = []
categories = []
# Projects (optional).
# Associate this post with one or more of your projects.
# Simply enter your project's folder or file name without extension.
# E.g. `projects = ["deep-learning"]` references
# `content/project/deep-learning/index.md`.
# Otherwise, set `projects = []`.
# projects = ["internal-project"]
# Featured image
# To use, add an image named `featured.jpg/png` to your page's folder.
[image]
# Caption (optional)
caption = ""
# Focal point (optional)
# Options: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight
focal_point = ""
+++
```python
from IPython.core.display import Image
Image('https://www.python.org/static/community_logos/python-logo-master-v3-TM-flattened.png')
```
![png](./academic_0_0.png)
```python
print("Welcome to Academic!")
```
Welcome to Academic!
## Install Python and Jupyter
[Install Anaconda](https://www.anaconda.com/distribution/#download-section) which includes Python 3 and Jupyter notebook.
Otherwise, for advanced users, install Jupyter notebook with `pip3 install jupyter`.
## Create a new blog post [as usual](https://sourcethemes.com/academic/docs/managing-content/#create-a-blog-post)
Run the following commands in your Terminal, substituting `<MY_WEBSITE_FOLDER>` and `my-post` with the file path to your Academic website folder and a name for your blog post (without spaces), respectively:
```bash
cd <MY_WEBSITE_FOLDER>
hugo new --kind post post/my-post
cd <MY_WEBSITE_FOLDER>/content/post/my-post/
```
## Create or upload a Jupyter notebook
Run the following command to start Jupyter within your new blog post folder. Then create a new Jupyter notebook (*New > Python Notebook*) or upload a notebook.
```bash
jupyter notebook
```
## Convert notebook to Markdown
```bash
jupyter nbconvert Untitled.ipynb --to markdown --NbConvertApp.output_files_dir=.
# Copy the contents of Untitled.md and append it to index.md:
cat Untitled.md | tee -a index.md
# Remove the temporary file:
rm Untitled.md
```
## Edit your post metadata
Open `index.md` in your text editor and edit the title etc. in the [front matter](https://sourcethemes.com/academic/docs/front-matter/) according to your preference.
To set a [featured image](https://sourcethemes.com/academic/docs/managing-content/#featured-image), place an image named `featured` into your post's folder.
For other tips, such as using math, see the guide on [writing content with Academic](https://sourcethemes.com/academic/docs/writing-markdown-latex/).