Skip to content

Commit

Permalink
Hosting notebooks online
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsp committed Jul 1, 2024
1 parent adce8d9 commit 547ce14
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
59 changes: 59 additions & 0 deletions src/en/docs/notebooks-online.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
title: "📕 Put notebooks online – Pluto.jl notebooks as web pages"
tags: ["docs", "publishing"]
order: 1
layout: "md.jlmd"
---

# How to host Pluto.jl notebooks online

When you are done writing your notebook, you can put it on the internet as a website! Notebooks as websites is a core feature of Pluto. This page will explain how you go from a notebook on your computer, say `animals.jl`, to a website like `https://example.com/animals`, where anyone can read your notebook directly, without needing to install Julia or Pluto.

There are many options fitting to different needs. Some are really easy, while others are more complex.

> ### 📎 Pluto file formats
> And good to know: Pluto notebooks are `.jl` files, which only contain the code of your notebook, not the outputs. For example, if your notebook contains `plot(x, y)`, then the resulting PNG image is not stored in the `.jl` file. Other people need to install Pluto to open the file.
>
> You can also use Pluto to **export** a notebook to a `.html` or `.pdf` file by clicking the <img src="https://cdn.jsdelivr.net/gh/ionic-team/[email protected]/src/svg/share-outline.svg" alt="share" width=17px> icon. These files **contain outputs**, like the plot image. Other people can open these files directly on their computer, without needing to install Pluto.
## GitHub: `static-export-template`
If you have a GitHub account, then this is the easiest option. Go to [github.com/JuliaPluto/static-export-template](https://github.com/JuliaPluto/static-export-template) and follow the easy instructions with screenshots to set up your repository. This sets up a repository with `.jl` notebook files, which are automatically executed, exported and hosted on the cloud. You get a website like `https://username.github.io/my_project` where you can read the notebooks.

**Pros:**
- Free
- Works for multiple notebooks
- Easy notebook updates: changing `.jl` files automatically updates the website

**Cons:**
- Takes 15-30 minutes to set up (but not too hard!)
- You need to use GitHub

![screenshot of the actions page, showing a currently running workflow](https://user-images.githubusercontent.com/6933510/103711844-978b5600-4fb8-11eb-8b1b-1e5bdacc1c85.png)

## Glass Notebook
If you have a GitHub account, then [glassnotebook.io](https://glassnotebook.io/) is a great option for hosting your notebooks online. Glass can also host notebooks **interactively**: people who visit your website can interact with sliders and buttons instantly!

**Pros:**
- Free (for static notebooks)
- Ability to host **interactive** notebooks (paid option)
- Easy user interface
- Support from developers if things don't work

**Cons:**
- You need to use GitHub


## Netlify drop: *"quick and dirty"*
If you just have a couple of `.html` files that you exported with Pluto, then you can use [netlify drop](https://app.netlify.com/drop) to put them online as a website. Put all `.html` files in one folder on your computer, and drag the folder into netlify drop.


**Pros:**
- Free
- Fast and easy

**Cons:**
- Updating the website with new notebooks requires a bit of care
- You need a Netlify account


# Work in progress, more coming!
1 change: 1 addition & 0 deletions src/sidebar data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Dict(
"docs" => [
"Introduction" => collections["docs"].pages collections["introduction"].pages,
"Reproducibility" => collections["docs"].pages collections["reproducibility"].pages,
"Publishing" => collections["docs"].pages collections["publishing"].pages,
"Advanced: Widgets" => collections["docs"].pages collections["advanced"].pages collections["widgets"].pages,
"Advanced: Internals" => collections["docs"].pages collections["advanced"].pages collections["internals"].pages,
],
Expand Down

0 comments on commit 547ce14

Please sign in to comment.