Creating and linking to pages

So. It's time to start creating the pages for your site. Let's first learn how Markdown works. If you're accustomed to Markdown feel free to skip this section.

Why Markdown?

If you load up the index.md file in a site you've created, you'll see something along these lines:

# Welcome to mysite

hello, world.

Learn more at [PocoCMS tutorials](https://pococms.com/docs/tutorials.html)

A few quick Markdown samples

It's sort of easy to figure out roughly how this document will render as HTML (but if not, don't worry because all this and more will be explained in this tutorial).

# This is most important

Wait for it..

## This is less important...

Oh, theres' more.

###### And this is way not important

Can you guess that *this* will be *italics*,
and that **this** will be **bold**?

Depending on the theme, it renders with the decorated text showing different formats:

Screenshot showing the previous Markdown sample rendered as HTML

Markdown has semantic importance

HTML is designed to structure your documents so that readers (including screen readers for visually compromised people) can get a feel for how important the parts of a document are by their formatting. Browsers use HTML to determine page formatting, along with stylesheets, many of which are provided by the PocoCMS theme framework to get you started.

The heading at the top of this page looks like this in its original Markdown file:

# Creating and linking to pages

The # part translates to an HTML <h1> tag. The tags from <h1> to<h6> are called headings. <h1> is given the greatest weight, an <h6> the least. Most search engines don't even bother with <h4> through <h6>.

At any rate the title above appears in the finished document as <h1>Creating and linking to pages</h1>.

As you can imagine, the subtitle ### A few quick Markdown samples on this page gets rendered as a level 3 heading: <h3>A few quick Markdown samples</h3>

Now let's start creating pages and writing some Markdown.

Creating a new page

mkdir docs
# Documentation hub

Welcome here. Now go back [home](/).

So we have a new page one subdirectory down. Let's link to it from the home page.

Check out our [Documentation](docs/index.html)
poco

Screen shot of revised home page

Screen shot of the new docs/index.html page

The home page should link to the page you've created in the new subdirectory, although something's wrong. The theming is gone. Not good. test the link while whe're here.

theme vs pagetheme

theme: base

Even though you made no change to the new page, it is now properly themed:

Screen shot of the new docs/index.html page

theme on the home page sets a global theme

If you use theme on the home page of your site, it causes every other page on the site to use that theme unless otherwise directed by a pagetheme. That way you don't have to type pagetheme: into the front matter of every page of your site.

Using theme won't work on any other page of the site. Just the home page index.md or README.md in your site's root directory.

The term for this is global theme.

pagetheme sets the theme on a per-page basis

So wait, what if you like having a global theme but sometimes prefer a different theme? You can override the global theme on any other page using the familiar pagetheme:

pagetheme: pasteboard

Having cleared that up, let's look into the link we just created to the new page, and the link from the new page back to the original one.

Here's an informal look at link formatting in Markdown:

[home](../index.html)

Also there's a shortcut. If the file in the subdirectory above is index.html, you can omit the filename:

[home](..)
[Markdown defined](https://pococms.com/docs/glossary.html#markdown)`

So how do you know what inside parts of a web page you can link to? In the HTML of the page you'll a notation something like this, in the case of the Why Markdown heading on this page:

<h2 id="why-markdown">Why Markdown?</h2>

If you have a passing acquaintance with HTML you'll know a heading looks like this:

<h2>Why Markdown?</h2>

The additional id="why-markdown" is called a unique identifier and makes it possible for browsers to find that part of the page:

<h2 id="why-markdown">Why Markdown?</h2>

The whole thing is called a bookmark or named anchor

PocoCMS creates bookmarks for all headings

PocoCMS generates a unique named anchor or bookmark for each heading levels, from <h1> to <h6>. If you have two headings that look the same, PocoCMS ensures the links are unique. For example, the first level 2 heading like this:

## Why Markdown?

Generates this HTML:

<h2 id="why-markdown">Why Markdown?</h2>

Bookmarks have a unique identifier

The additional id="why-markdown" is called a unique identifier and makes it possible for browsers to find that part of the page:

<h2 id="why-markdown">Why Markdown?</h2>

Unique identifiers are created even if headings repeat

If the heading is repeated within the same document (which is just a bad idea):

## Why Markdown?

The anchor text is generated with a trailing number. Notice the id="why-markdown-1" in the example below of a repeated heading:

<h2 id="why-markdown-1">Why Markdown?</h2>

View source on Windows: Ctrl+U

View source on MacOS: โŒ˜+U

If view source doesn't work

If those things don't work, you need to choose develeper mode for your browser. That's out of the scope of this document, but you can look it up here:

Learn more about Markdown

If you'd like to learn more about Markdown basics, see our guide at Markdown

Previous: Editing parts of a theme Next: Creating a theme