Browse Source

demo: add blog based on Jupyter notebook

George Cushen 6 năm trước cách đây
mục cha
commit
066e7ebcfb

+ 1 - 1
exampleSite/config/_default/config.toml

@@ -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
exampleSite/config/_default/params.toml

@@ -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.

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 9 - 0
exampleSite/content/post/jupyter/academic.ipynb


BIN
exampleSite/content/post/jupyter/academic_0_0.png


BIN
exampleSite/content/post/jupyter/featured.png


+ 98 - 0
exampleSite/content/post/jupyter/index.md

@@ -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/). 

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác