Create a page

Pages are the most fundamental building block for content. They’re useful for general standalone content which does not match one of the built-in content types on this page. You may also be interested in Widget Pages which enable you to add widgets to a page.

The simplest way of adding a page is to add a Markdown file using a .md extension at the root folder of your site.

For a site with just a homepage and an author, here’s what the root directory and associated URLs might look like with a new page named example:

.
|-- authors/    # => https://example.com/authors/
|-- example/index.md    # => https://example.com/example/
└── home/  # => https://example.com/

And here’s some example content for example/index.md:

---
title: An example title
summary: Here we describe how to add a page to your site.
date: "2018-06-28T00:00:00Z"

reading_time: false  # Show estimated reading time?
share: false  # Show social sharing links?
profile: false  # Show author profile?
comments: false  # Show comments?

# Optional header image (relative to `assets/media/` folder).
header:
  caption: ""
  image: ""
---

Add your *content* here...

If you have a lot of pages, you can organize them within a folder, for example:

.
|-- authors/    # => https://example.com/authors/
|-- example/about.md    # => https://example.com/example/about/
|-- example/terms.md    # => https://example.com/example/terms/
└── home/  # => https://example.com/

Linking to your new page

To link to your new page from the site navigation bar, edit config/_default/menu.toml. Add a new menu entry similar to:

[[main]]
  name = "My new page"  # A link title for your page.
  url = "example/"  # The URL of your page.
  weight = 50  # The position of your page in the menu.

To link to your new page from another page, add something like [My CV]({{< ref "cv/index.md" >}}) to the content of one of your existing pages.

Example: creating a Curriculum Vitae page

Create a cv/index.md page for your Curriculum Vitae in your content folder. Add a front matter to the file, similar to that above, and add the content of your Curriculum Vitae below the front matter. Then create a link to your new page by following the steps in the above section.

Alternatively, for the above example, we could use a PDF of your Curriculum Vitae. For this purpose, create a folder called uploads within your static folder and move a PDF file named cv.pdf to that location, so we have a static/uploads/cv.pdf file path. The PDF can then be linked to from any content by using the code: {{% staticref "uploads/cv.pdf" %}}Download my CV{{% /staticref %}}.

Previous
Next