Origami comics

Changing file extensions

As you process files to make your site, you’ll often want to change the file extensions.

kingfisher.md
---
title: How the Kingfisher Got His Bill
---

Some old men say that the Kingfisher was meant in the beginning to be a water
bird, but as he had not been given either web feet or a good bill he could not
make a living. The animals held a council over it and decided to make him a bill
like a long sharp awl for a fish-gig (fish-spear). So they made him a fish-gig
and fastened it on in front of his mouth. He flew to the top of a tree, sailed
out and darted down into the water, and came up with a fish on his gig. And he
has been the best gigger ever since.

Some others say it was this way: A Blacksnake found a Yellowhammer’s nest in a
hollow tree, and after swallowing the young birds, coiled up to sleep in the
nest, where the mother bird found him when she came home. She went for help to
the Little People, who sent her to the Kingfisher. He came, and after flying
back and forth past the hole a few times, made one dart at the snake and pulled
him out dead. When they looked they found a hole in the snake’s head where the
Kingfisher had pierced it with a slender _tugălû′nă_ fish, which he carried in
his bill like a lance. From this the Little People concluded that he would make
a first-class gigger if he only had the right spear, so they gave him his long
bill as a reward.
http://localhost:5000/kingfisher.html

How the Kingfisher Got His Bill

Some old men say that the Kingfisher was meant in the beginning to be a water bird, but as he had not been given either web feet or a good bill he could not make a living. The animals held a council over it and decided to make him a bill like a long sharp awl for a fish-gig (fish-spear). So they made him a fish-gig and fastened it on in front of his mouth. He flew to the top of a tree, sailed out and darted down into the water, and came up with a fish on his gig. And he has been the best gigger ever since.

Some others say it was this way: A Blacksnake found a Yellowhammer’s nest in a hollow tree, and after swallowing the young birds, coiled up to sleep in the nest, where the mother bird found him when she came home. She went for help to the Little People, who sent her to the Kingfisher. He came, and after flying back and forth past the hole a few times, made one dart at the snake and pulled him out dead. When they looked they found a hole in the snake’s head where the Kingfisher had pierced it with a slender tugălû′nă fish, which he carried in his bill like a lance. From this the Little People concluded that he would make a first-class gigger if he only had the right spear, so they gave him his long bill as a reward.

Here the .md file becomes a .html file.

A file extension like .md or .txt tells us what’s in the file.

kingfisher.md
---
title: How the Kingfisher Got His Bill
---

Some old men say that the Kingfisher was meant in the beginning to be a water
bird, but as he had not been given either web feet or a good bill he could not
make a living. The animals held a council over it and decided to make him a bill
like a long sharp awl for a fish-gig (fish-spear). So they made him a fish-gig
and fastened it on in front of his mouth. He flew to the top of a tree, sailed
out and darted down into the water, and came up with a fish on his gig. And he
has been the best gigger ever since.

Some others say it was this way: A Blacksnake found a Yellowhammer’s nest in a
hollow tree, and after swallowing the young birds, coiled up to sleep in the
nest, where the mother bird found him when she came home. She went for help to
the Little People, who sent her to the Kingfisher. He came, and after flying
back and forth past the hole a few times, made one dart at the snake and pulled
him out dead. When they looked they found a hole in the snake’s head where the
Kingfisher had pierced it with a slender _tugălû′nă_ fish, which he carried in
his bill like a lance. From this the Little People concluded that he would make
a first-class gigger if he only had the right spear, so they gave him his long
bill as a reward.

A file extension is a kind of type signature.

Origami’s mapextension function changes both the file’s extension and its content.

site.ori
{
  // Stories area is based on markdown files in the `content` folder
  stories/ = Tree.mapExtension(content/, {
    extension: ".md→.html"  // Change file extension from .md to .html
    value: story.ori        // Apply the story template to the content
  })
}
$ ori keys content
- kingfisher.md
$ ori keys site.ori/stories
- kingfisher.html
$ 

For more custom file name changes, a key function can convert the original file name into a new one.

site.ori
{
  stories/ = Tree.map(content/, {
    // Change a file name like "hello.md" to "story-hello"
    key: (value, key) => `story-${ key.replace(".md", "") }`
    value: story.ori
  })
}
$ ori keys content
- kingfisher.md
$ ori keys site.ori/stories
- story-kingfisher
$ 

Read more: Origami's mapExtension function

  Comic index