on 459c430 help sign in
95 lines 3.0 kB history raw
1---
2navhome: /docs
3sort: 1
4title: A simple blog
5next: true
6---
8# A simple blog
10Publishing markdown using Urbit is really easy. Here we'll create a
11very simple blog and publish our first posts.
13First, let's setup a desk to serve our posts from:
15 |merge %site ~your-urbit %home
17Then let's mount that desk to unix:
19 |mount /=site=
21You should now be able to find a `/site` folder inside of your pier
22directory (either `comet/` or `your-urbit/`).
24To begin serving files from this new desk use `|serve`:
26 |serve %site
28First let's create the landing page for our blog. Create the file
29`site/web/blog.md`:
31 ---
32 anchor: none
33 ---
35 # Hello
37 This is a simple blog I built on Urbit.
39 <list dataType="post"></list>
41Try viewing this file at `http://your-urbit.urbit.org/blog`. The only
42special thing about this page is the `anchor: none` YAML which simply
43turns off the Tree navigation. Normally Tree gives navigation
44controls for walking around the filesystem, but taking them away makes
45the page seem more like a landing page.
47The page looks pretty boring now. Let's add our first post. From
48unix run `mkdir your-urbit/site/web/blog; touch
49your-urbit/site/web/blog/post-1.md`. (Currently [there's a
50bug](https://github.com/urbit/urbit/issues/321) that prevents empty
51directories from getting created, so we have to `touch` a file inside
52them first.) In `blog/post-1.md` let's add some filler content:
54 ---
55 date: ~2016.4.20
56 title: My first post!
57 type: post
58 navhome: /blog
59 ---
61 Is this a decentralized Medium? Let's find out.
63 But first, how about a long quote from Paramenides:
65 > True, he said; and therefore when ideas are what they are in
66 relation to one another, their essence is determined by a relation
67 among themselves, and has nothing to do with the resemblances, or
68 whatever they are to be termed, which are in our sphere, and from
69 which we receive this or that name when we partake of them. And
70 the things which are within our sphere and have the same names
71 with them, are likewise only relative to one another, and not to
72 the ideas which have the same names with them, but belong to
73 themselves and not to them.
75 Good to get that out of the way.
79You should be able to view this file at:
80`http://your-urbit.urbit.org/blog/post-1.md`. You'll also notice that
81now the list of posts here: `http://your-urbit.urbit.org/blog` has
82updated.
84Here we use two pieces of YAML worth noting: `type` and `navhome`.
86- `type` implies that the page has some special handling by Tree.
87When `type` is `post` we automatically put in the `date`, `title`
88and `author` when they're specified and add some styles.
90- `navhome` sets the path used by the home button (the circle in the
91 top left). Since we want to send people back to the root of our
92 blog, we set this to `/blog`
94Adding posts is as easy as dropping markdown files into the `blog/`
95directory. Pretty easy!