mirror of
https://github.com/gcushen/hugo-academic.git
synced 2025-07-26 03:00:50 +02:00
docs: add migration docs
This commit is contained in:
parent
b49528cf1e
commit
de76516846
9 changed files with 215 additions and 0 deletions
17
docs/README.md
Normal file
17
docs/README.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Wowchemy Documentation
|
||||
|
||||
This is the public repository for [Wowchemy Documentation](http://wowchemy.com/docs/), a static website generated with the [Documentation template](https://wowchemy.com/hugo-themes/).
|
||||
|
||||
We intend the docs to be read on the website. You can also read them here but be warned that links won't often work and other things may appear missing or less than optimal.
|
||||
|
||||
## Edit the docs
|
||||
|
||||
If you have an improvement, please click the pencil button to edit the file on GitHub and then click the _Commit_ (save) button to easily submit it as a PR for review.
|
||||
|
||||
Otherwise, if you cannot find the file to edit in this repo, please open an issue with the improved text or suggestion.
|
||||
|
||||
## License
|
||||
|
||||
Documentation (including guides, references, and associated images) are licensed under a [Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License](http://creativecommons.org/licenses/by-nc-nd/4.0/).
|
||||
|
||||
Code snippets are licensed under the MIT license.
|
6
docs/config.yaml
Normal file
6
docs/config.yaml
Normal file
|
@ -0,0 +1,6 @@
|
|||
module:
|
||||
mounts:
|
||||
- source: media/docs
|
||||
target: assets/media/docs
|
||||
- source: en
|
||||
target: content/en/docs
|
7
docs/en/import/_index.md
Normal file
7
docs/en/import/_index.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: Import
|
||||
icon_pack: fas
|
||||
icon: file-import
|
||||
weight: 200
|
||||
cms_exclude: true
|
||||
---
|
80
docs/en/import/jupyter.md
Normal file
80
docs/en/import/jupyter.md
Normal file
|
@ -0,0 +1,80 @@
|
|||
---
|
||||
title: Import Jupyter Notebooks
|
||||
linktitle: From Jupyter Notebooks
|
||||
date: 2019-02-12
|
||||
summary: Learn how to write and import Jupyter Notebooks from JupyterLab.
|
||||
---
|
||||
|
||||
In this guide, we'll **learn how to blog in Wowchemy using Jupyter Notebooks**.
|
||||
|
||||
Here's a snippet from a Jupyter notebook, for example:
|
||||
|
||||
```python
|
||||
print("I am a Jupyter Notebook!")
|
||||
```
|
||||
|
||||
I am a Jupyter Notebook!
|
||||
|
||||
## 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]({{< relref "../content/_index.md#create-a-blog-post" >}})
|
||||
|
||||
Run the following commands in your Terminal, substituting `<MY_WEBSITE_FOLDER>` and `my-post` with the file path to your Wowchemy 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]({{< relref "front-matter.md" >}}) according to your preference.
|
||||
|
||||
To set a [featured image]({{< relref "../content/_index.md#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 Wowchemy]({{< relref "../content/writing-markdown-latex.md" >}}).
|
||||
|
||||
## Alternative approaches
|
||||
|
||||
Alternatively, a Jupyter notebook can be embedded in a page by following one of the approaches below:
|
||||
|
||||
1. Upload your notebook as a [GitHub Gist](https://gist.github.com) and click *Embed* to copy and paste your hosted notebook into the body of content in Wowchemy
|
||||
|
||||
2. [Convert your notebook to HTML](
|
||||
https://nbconvert.readthedocs.io/) using `jupyter nbconvert --to html <NOTEBOOK_NAME>.ipynb`. Then move the resulting HTML file to your page's folder and embed it into the body of the page's Markdown file using:
|
||||
|
||||
<iframe
|
||||
src="./<CONVERTED_NOTEBOOK_FILENAME>"
|
||||
width="90%"
|
||||
height="1000px"
|
||||
style="border:none;">
|
||||
</iframe>
|
||||
|
||||
3. Upload your notebook to a cloud notebook service such as [Microsoft Azure](https://notebooks.azure.com/), [Google Cloud Datalab](https://cloud.google.com/datalab/) or [Kyso](https://kyso.io). Then click their *Embed* button, pasting their custom embedding code into the body of your page's Markdown file
|
||||
|
||||
4. Copy snippets of code from your notebook and paste them into the body of your page using [Wowchemy's code highlighting]({{< relref "../content/writing-markdown-latex.md#code-highlighting" >}})
|
34
docs/en/import/migrate-from-jekyll.md
Normal file
34
docs/en/import/migrate-from-jekyll.md
Normal file
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
title: Migrate from Jekyll
|
||||
linktitle: From Jekyll
|
||||
date: 2014-03-10
|
||||
summary: Learn how to migrate your site from Jekyll to the Wowchemy website building framework for Hugo.
|
||||
---
|
||||
|
||||
Here are a few tips for migrating an existing website from Jekyll to Hugo. These tips can be applied in conjunction with following Hugo Wowchemy's [getting started guide]({{< relref "get-started.md" >}}).
|
||||
|
||||
## Move static content to `static`
|
||||
Jekyll has a rule that any directory not starting with `_` will be copied as-is to the `_site` output. Hugo keeps all static content under `static`. You should therefore move it all there.
|
||||
With Jekyll, something that looked like
|
||||
|
||||
▾ <root>/
|
||||
▾ images/
|
||||
logo.png
|
||||
|
||||
should become
|
||||
|
||||
▾ <root>/
|
||||
▾ static/
|
||||
▾ images/
|
||||
logo.png
|
||||
|
||||
Additionally, you'll want any files that should reside at the root (such as `CNAME`) to be moved to `static`.
|
||||
|
||||
## Fix content
|
||||
Depending on the amount of customization that was done for each post in Jekyll, this step will require more or less effort. There are no hard and fast rules here except reviewing any errors running `hugo server` and comparing your site with the structure, config, and front matter from the unedited Wowchemy templates are your friends. Test your changes and fix errors as needed.
|
||||
|
||||
## Publish
|
||||
The default is for Jekyll to publish the website to a `_site` directory, whereas Hugo publishes to a `public` directory.
|
||||
|
||||
## A practical example
|
||||
Alexandre Normand migrated his website from Jekyll to Hugo in less than a day. You can see all his changes by looking at this GitHub [diff](https://github.com/alexandre-normand/alexandre-normand/compare/869d69435bd2665c3fbf5b5c78d4c22759d7613a...b7f6605b1265e83b4b81495423294208cc74d610). However, bear in mind that this example is **not specific to the Wowchemy nor does it use the latest version of Hugo**.
|
22
docs/en/import/migrate-from-wordpress.md
Normal file
22
docs/en/import/migrate-from-wordpress.md
Normal file
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
title: Migrate from Wordpress
|
||||
linktitle: From Wordpress
|
||||
date: 2017-12-03
|
||||
summary: Learn how to migrate your site from Wordpress to the Wowchemy website building framework for Hugo.
|
||||
---
|
||||
|
||||
To migrate your website from Wordpress to Wowchemy is a two phase process:
|
||||
|
||||
## Phase One
|
||||
|
||||
First, install the [WordPress to Jekyll Exporter](https://wordpress.org/plugins/jekyll-exporter/) plugin into your Wordpress installation by following these steps:
|
||||
|
||||
1. Place the [WordPress to Jekyll Exporter](https://wordpress.org/plugins/jekyll-exporter/) plugin in `/wp-content/plugins/` folder
|
||||
2. Activate plugin in WordPress dashboard
|
||||
3. Select `Export to Jekyll` from the `Tools` menu
|
||||
|
||||
The WordPress plugin converts all posts, pages, taxonomies, metadata, and settings to Markdown and YAML with just a single click. A zip file will be generated, containing `_config.yml`, pages, and `_posts` folder containing `.md` Markdown files for each post.
|
||||
|
||||
## Phase Two
|
||||
|
||||
Given the Jekyll formatted contents of your generated zip file in the step above, proceed to follow the guide on [importing a Jekyll site into Wowchemy]({{< relref "migrate-from-jekyll.md" >}}).
|
46
docs/en/import/rmarkdown.md
Normal file
46
docs/en/import/rmarkdown.md
Normal file
|
@ -0,0 +1,46 @@
|
|||
---
|
||||
title: Import RMarkdown
|
||||
linktitle: From RMarkdown
|
||||
date: 2021-01-10
|
||||
summary: Learn how to write and import RMarkdown content from RStudio.
|
||||
---
|
||||
|
||||
RMarkdown is a popular format with statisticians. It is often edited with RStudio and used to write technical blog posts or documentation that include snippets of the R statistical programming language.
|
||||
|
||||
So how can we include R content in our Wowchemy site?
|
||||
|
||||
# Prerequisites
|
||||
|
||||
[Follow the guide to setup Wowchemy and Hugo on your computer]({{< relref "/docs/getting-started/install-locally" >}}).
|
||||
|
||||
# Publishing content with RStudio
|
||||
|
||||
First check that you have installed the prerequisites in the previous section.
|
||||
|
||||
It's recommended to convert RMarkdown files directly to Markdown **without Blogdown** by using `render("input.Rmd", md_document())` or adding `output: md_document` to the file's front matter.
|
||||
|
||||
Once the RMarkdown has been converted to Markdown (or HTML), Wowchemy and Hugo can then be used directly, as usual, such as with the command `hugo server`.
|
||||
|
||||
# Alternatively: Using the Blogdown wrapper
|
||||
|
||||
The RStudio team released Blogdown, a wrapper around Hugo for the RStudio IDE. However, users report that **Blogdown doesn't fully support modern Hugo versions**, with the RStudio team confirming these bug reports on GitHub. Therefore, it's not currently recommended to use Blogdown. Also, as Blogdown is an extra tool in the workflow, it can add unnecessary additional complexity to projects.
|
||||
|
||||
1. Open [RStudio](https://www.rstudio.com/products/rstudio/) and install *Blogdown*:
|
||||
|
||||
remotes::install_github('rstudio/blogdown')
|
||||
|
||||
1. Open `academic.Rproj` from your site's folder, [downloading it if necessary](https://github.com/wowchemy/starter-academic/blob/main/academic.Rproj)
|
||||
|
||||
1. Blogdown will automatically move your site's `config/_default/config.yaml` file to the site folder as [Blogdown does not support Hugo's config folder](https://github.com/rstudio/blogdown/issues/359)
|
||||
|
||||
1. In the RStudio menu bar, choose **Addins > Serve Site** (clicking this button will call `blogdown:::serve_site()`)
|
||||
- Paste the local URL which RStudio provides (e.g. http://127.0.0.1:4321) into your web browser to preview your new site
|
||||
- Avoid using the integrated RStudio web browser as it can be outdated and buggy
|
||||
|
||||
## RMarkdown vs Rmd
|
||||
|
||||
It's recommended to save R content as Markdown with the **`.Rmarkdown` file extension** rather than as HTML with the `.Rmd` extension.
|
||||
|
||||
Why is RMarkdown recommended?
|
||||
|
||||
Hugo is used to convert Markdown content into an HTML website powered by a Wowchemy template and Wowchemy's page building components. Hence, by providing Rmd's HTML rather than processed RMarkdown as the input to Hugo and Wowchemy, you may experience conflicts as the Rmd ecosystem performs similar actions to Hugo yet has little awareness of Hugo and Wowchemy templates.
|
3
docs/go.mod
Normal file
3
docs/go.mod
Normal file
|
@ -0,0 +1,3 @@
|
|||
module github.com/wowchemy/wowchemy-hugo-themes/docs
|
||||
|
||||
go 1.15
|
0
docs/media/docs/.gitkeep
Normal file
0
docs/media/docs/.gitkeep
Normal file
Loading…
Add table
Add a link
Reference in a new issue