{
 "cells": [
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    "---\n",
    "title: Display Jupyter Notebooks with Academic\n",
    "subtitle: Learn how to blog in Academic using Jupyter notebooks\n",
    "summary: Learn how to blog in Academic using Jupyter notebooks\n",
    "authors:\n",
    "- admin\n",
    "tags: []\n",
    "categories: []\n",
    "date: \"2019-02-05T00:00:00Z\"\n",
    "lastMod: \"2019-09-05T00:00:00Z\"\n",
    "featured: false\n",
    "draft: false\n",
    "\n",
    "# Featured image\n",
    "# To use, add an image named `featured.jpg/png` to your page's folder. \n",
    "image:\n",
    "  caption: \"\"\n",
    "  focal_point: \"\"\n",
    "\n",
    "# Projects (optional).\n",
    "#   Associate this post with one or more of your projects.\n",
    "#   Simply enter your project's folder or file name without extension.\n",
    "#   E.g. `projects = [\"internal-project\"]` references \n",
    "#   `content/project/deep-learning/index.md`.\n",
    "#   Otherwise, set `projects = []`.\n",
    "projects: []\n",
    "---"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 14876 characters]\n",
      "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 JupyterLab\n",
    "\n",
    "[Install Anaconda](https://www.anaconda.com/distribution/#download-section) which includes Python 3 and JupyterLab.\n",
    "\n",
    "Alternatively, install JupyterLab with `pip3 install jupyterlab`."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Create or upload a Jupyter notebook\n",
    "\n",
    "Run the following commands in your Terminal, substituting `<MY-WEBSITE-FOLDER>` and `<SHORT-POST-TITLE>` with the file path to your Academic website folder and a short title for your blog post (use hyphens instead of spaces), respectively:"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "```bash\n",
    "mkdir -p <MY-WEBSITE-FOLDER>/content/post/<SHORT-POST-TITLE>/\n",
    "cd <MY-WEBSITE-FOLDER>/content/post/<SHORT-POST-TITLE>/\n",
    "jupyter lab index.ipynb\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The `jupyter` command above will launch the JupyterLab editor, allowing us to add Academic metadata and write the content."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Edit your post metadata\n",
    "\n",
    "The first cell of your Jupter notebook will contain your post metadata ([front matter](https://sourcethemes.com/academic/docs/front-matter/)).\n",
    "\n",
    "In Jupter, choose _Markdown_ as the type of the first cell and wrap your Academic metadata in three dashes, indicating that it is YAML front matter: \n",
    "\n",
    "```\n",
    "---\n",
    "title: My post's title\n",
    "date: 2019-09-01\n",
    "\n",
    "# Put any other Academic metadata here...\n",
    "---\n",
    "```\n",
    "\n",
    "Edit the metadata of your post, using the [documentation](https://sourcethemes.com/academic/docs/managing-content) as a guide to the available options.\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/). "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Convert notebook to Markdown"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "```bash\n",
    "jupyter nbconvert index.ipynb --to markdown --NbConvertApp.output_files_dir=.\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example\n",
    "\n",
    "This post was created with Jupyter. The orginal files can be found at https://github.com/gcushen/hugo-academic/tree/master/exampleSite/content/post/jupyter"
   ]
  }
 ],
 "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.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
