| title | Create a peer-to-peer blog |
|---|---|
| section | tutorials |
| sectionTitle | Tutorials |
| order | 1 |
Creating a blog on Beaker is easy to do with a static site generator. In this tutorial, we’ll use Jekyll. Start by following their instructions for creating a new blog:
bash ```bash ~$ gem install jekyll bundler ~$ jekyll new my-awesome-p2p-blog ~$ cd my-awesome-p2p-blog ```My blog is located at ~/my-awesome-p2p-blog, which means that the site it generates is located at ~/my-awesome-p2p-blog/_site.
Update your _config.yml:
markdown: kramdown theme: minima gems:
- jekyll-feed exclude:
- Gemfile
- Gemfile.lock
Run `jekyll build` to generate your site’s files:
<figcaption class="code">bash</figcaption>
```bash
~/my-awesome-p2p-blog $ jekyll build
Configuration file: /Users/paulfrazee/my-awesome-p2p-blog/_config.yml
Source: /Users/paulfrazee/my-awesome-p2p-blog
Destination: /Users/paulfrazee/my-awesome-p2p-blog/_site
Incremental build: disabled. Enable with --incremental
Generating...
done in 0.854 seconds.
Auto-regeneration: disabled. Use --watch to enable.
Now, let’s create the site in Beaker. Open the dropdown menu in Beaker, and select “New site”:
Click "New site" in the dropdown menuFill in the title and description of your blog:
Set the title and descriptionClick "Create site" and Beaker will take you to the library page for your site:
Your new site in your LibraryBy default, Beaker creates a new folder for you under the ~/Sites directory. In this case, we want to pick our own folder, because we want to use the ./_site folder within our Jekyll blog. To select the _site directory, click "Change folder" in the Library dropdown menu.
For my blog, I set the folder to ~/my-awesome-p2p-blog/_site:
You’ll see Beaker's staging area populate with the new changes immediately.
The staging area shows unpublished changesWe'll publish in a moment. First, let's click “View site” to see how the site looks.
The unpublished siteOK! It looks pretty good so far. Check out the Jekyll documentation to learn how to author content and change the styles.
Jekyll has a builtin command, bundle exec jekyll serve, for previewing your site on a local development server. But Beaker serves your site for you at its Dat URL, so you just need Jekyll to do the build process:
There’s one last step before you can share your blog; you need to publish your files. Back in the Library page for your blog, you should see your changes listed:
The staging area shows unpublished changesThis is the staging area. It shows all the local changes that you’ve made, but haven’t yet published. Until you publish, only you will be able to see the changes.
Click “Publish,” and the changes will be committed to your site.
Click “Publish” and the site is readyNow you can share the URL to anybody using Beaker, and keep your computer online, and they’ll be able to download the site.
One last tip: once you have jekyll build --watch running, Jekyll will automatically generate a new version of your site when you make updates. If you want Beaker to automatically reload the page too, you can turn on Live reloading:
Navigate to the site, click the dropdown menu in the top right, then click “Turn on live reloading.” You'll see a lightning symbol in the URL bar. Now, any time you make a change, the site will auto-refresh.