Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs next #858

Merged
merged 52 commits into from
Jan 20, 2020
Merged
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
b678c82
Update installation.md
photong Nov 21, 2019
9603032
Update cli-usage.md
photong Nov 21, 2019
86200f2
Update installation.md
photong Nov 21, 2019
9750098
Update directory-structure.md
photong Nov 21, 2019
44ce379
Update configuration.md
photong Nov 21, 2019
1251dee
Update overview.md
photong Nov 21, 2019
751bea3
Update section.md
photong Nov 21, 2019
6327c75
Update page.md
photong Nov 21, 2019
3c379d3
Update section.md
photong Nov 22, 2019
d20eb8c
Update configuration.md
photong Nov 22, 2019
19c511c
Update page.md
photong Nov 22, 2019
9cef2ca
Update section.md
photong Nov 22, 2019
80fa637
Update page.md
photong Nov 22, 2019
b9ba051
Update shortcodes.md
photong Nov 22, 2019
91a1f31
Update linking.md
photong Nov 22, 2019
e5087bd
Update table-of-contents.md
photong Nov 22, 2019
8af696d
Update syntax-highlighting.md
photong Nov 22, 2019
e4bb3a8
Update taxonomies.md
photong Nov 22, 2019
785deb7
Update search.md
photong Nov 22, 2019
d63008d
Update sass.md
photong Nov 22, 2019
614099d
Update index.md
photong Nov 22, 2019
f568f92
Update multilingual.md
photong Nov 22, 2019
02f6633
Update overview.md
photong Nov 22, 2019
eaf7771
Update pages-sections.md
photong Nov 22, 2019
4a0e67a
Update pagination.md
photong Nov 22, 2019
b1739fb
Update taxonomies.md
photong Nov 22, 2019
70a48e7
Update rss.md
photong Nov 22, 2019
30ea9e8
Update sitemap.md
photong Nov 22, 2019
d3ac9a2
Update robots.md
photong Nov 22, 2019
a1ec03d
Update 404.md
photong Nov 22, 2019
a7036c0
Update archive.md
photong Nov 22, 2019
623df7d
Update overview.md
photong Nov 22, 2019
73146d0
Update installing-and-using-themes.md
photong Nov 22, 2019
6e3e8e3
Update creating-a-theme.md
photong Nov 22, 2019
60ab8f7
Update netlify.md
photong Nov 22, 2019
dcd16e6
Update github-pages.md
photong Nov 22, 2019
eca7a04
Update gitlab-pages.md
photong Nov 22, 2019
e0dd168
Updates.
photong Nov 27, 2019
7dfab02
Merge branch 'next' into docs-next
photong Nov 27, 2019
7bb482b
Skip link checking for URL with prefix in config (#846)
TjeuKayim Nov 25, 2019
7850603
Fix some doc changes
Keats Nov 26, 2019
0c2147f
Section extra -> SitemapEntry (#850)
stanistan Nov 26, 2019
358c1c8
Update deps
Keats Nov 26, 2019
a7b2591
Remove tutorial link.
photong Nov 27, 2019
9f27c60
Update overview.md
photong Nov 27, 2019
7aebe9a
Update page.md
photong Nov 27, 2019
264cd71
Update section.md
photong Nov 27, 2019
070c206
Update netlify.md
photong Nov 27, 2019
c59312d
Update overview.md
photong Nov 27, 2019
417ed4a
Change some wording.
photong Nov 28, 2019
34e24fd
Merge branch 'docs-next' of https://github.com/photong/zola into docs…
photong Nov 28, 2019
35bdcfb
Update overview.md
photong Nov 28, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "Configuration"
weight = 4
weight = 40
+++

The default configuration is sufficient to get Zola running locally but not more than that.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "Directory structure"
weight = 3
weight = 30
+++

After running `zola init`, you should see the following structure in your directory:
2 changes: 1 addition & 1 deletion docs/content/documentation/getting-started/installation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "Installation"
weight = 1
weight = 10
+++

Zola provides pre-built binaries for MacOS, Linux and Windows on the
206 changes: 206 additions & 0 deletions docs/content/documentation/getting-started/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
+++
title = "Overview"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we call that Quickstart?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding default theme, yes, that would be great. Bulma (bulma.io) and Spectre (https://picturepan2.github.io/spectre/) are two ligthweight CSS frameworks. Maybe something based on them?

I called this section "Overview" to be consistent with other sections (they all have an "Overview" page) and this page gives an overview of Zola and how it works. Quickstart is also good.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think we should use any CSS framework for a default theme. It is easy to write a theme without framework (I did one https://git.42l.fr/HugoTrentesaux/toucan) and it makes the template easier to read and modify and shows better the interest of native SASS compilation. I made a theme with Bulma (https://git.42l.fr/HugoTrentesaux/dunitrust_website) and I am currently thinking about a rewrite without it. If I had to choose a framework, I would rather go to https://www.knacss.com/ or https://purecss.io/. But this is really a question of taste. We can later develop themes for each of this frameworks, but for now, I prefer to stick to CSS.

Copy link
Contributor Author

@photong photong Nov 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The toucan theme is great for showing SASS integration. I'll use it for the full tutorial. For the Quickstart, I'll remove Bulma and use toucan if it's the default. If not, it's probably ok to just use pure HTML because it's meant to just give a quick taste of Zola, not produce an actual site.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with removing Bulma/any css for the quickstart. It is not that important for a Zola quickstart.

weight = 5
+++

## Zola at a Glance

Zola is a static site generator (SSG), similar to [Hugo](https://gohugo.io/), [Pelican](https://blog.getpelican.com/), and [Jekyll](https://jekyllrb.com/) (for a comprehensive list of SSGs, please see the [StaticGen](https://www.staticgen.com/) site). It is written in [Rust](https://www.rust-lang.org/) and uses the [Tera](https://tera.netlify.com/) template engine, which is similar to [Jinja2](https://jinja.palletsprojects.com/en/2.10.x/), [Django templates](https://docs.djangoproject.com/en/2.2/topics/templates/), [Liquid](https://shopify.github.io/liquid/), and [Twig](https://twig.symfony.com/). Content is written in [CommonMark](https://commonmark.org/), a strongly defined, highly compatible specification of [Markdown](https://www.markdownguide.org/).

SSGs use dynamic templates to transform content into static HTML pages. Static sites are thus very fast and require no databases, making them easy to host. A comparison between static and dynamic sites, such as WordPress, Drupal, and Django, can be found [here](https://dev.to/ashenmaster/static-vs-dynamic-sites-61f).

To get a taste of Zola, please see the quick overview below.

## First Steps with Zola

Unlike some SSGs, Zola makes no assumptions regarding the structure of your site. In this overview, we'll be making a simple blog site.

### Initialize Site

> This overview is based on Zola 0.9.

Please see the detailed [installation instructions for your platform](@/documentation/getting-started/installation.md). With Zola installed, let's initialize our site:

```bash
$ zola init myblog
```

You will be asked a few questions.

```
> What is the URL of your site? (https://example.com):
> Do you want to enable Sass compilation? [Y/n]:
> Do you want to enable syntax highlighting? [y/N]:
> Do you want to build a search index of the content? [y/N]:
```

For our blog, let's accept the default values (i.e., press Enter for each question). We now have a `myblog` directory with the following structure:

```bash
├── config.toml
├── content
├── sass
├── static
├── templates
└── themes
```

Let's start the zola development server with:

```bash
$ zola serve
Building site...
-> Creating 0 pages (0 orphan), 0 sections, and processing 0 images
```

> This command must be run in the base Zola directory, which contains `config.toml`.

If you point your web browser to <http://127.0.0.1:1111>, you should see a "Welcome to Zola" message.

### Home Page

Let's make a home page. To do this, let's first create a `base.html` file inside the `templates` directory. This step will make more sense as we move through this overview. We'll be using the CSS framework [Bulma](https://bulma.io/).

```html
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<title>MyBlog</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.8.0/css/bulma.min.css">
</head>

<body>
<section class="section">
<div class="container">
{% block content %} {% endblock %}
</div>
</section>
</body>

</html>
```

Now, let's create an `index.html` file inside the `templates` directory.

```html
{% extends "base.html" %}

{% block content %}
<h1 class="title">
This is my blog made with Zola.
</h1>
{% endblock content %}
```

This tells Zola that `index.html` extends our `base.html` file and replaces the block called "content" with the text between the `{% block content %}` and `{% endblock content %}` tags.

### Content Directory

Now let's add some content. We'll start by making a `blog` subdirectory in the `content` directory and creating an `_index.md` file inside it. This file tells Zola that `blog` is a [section](@/documentation/content/section.md), which is how content is categorized in Zola.

```bash
├── content
│ └── blog
│ └── _index.md
```

In the `_index.md` file, we'll set the following variables in [TOML](https://github.com/toml-lang/toml) format:

```md
+++
title = "List of blog posts"
sort_by = "date"
template = "blog.html"
page_template = "blog-page.html"
+++
```

> Note that although no variables are mandatory, the opening and closing `+++` are required.

* *sort_by = "date"* tells Zola to use the date to order our section pages (more on pages below).
* *template = "blog.html"* tells Zola to use `blog.html` in the `templates` directory as the template for listing the Markdown files in this section.
* *page_template = "blog-page.html"* tells Zola to use `blog-page.html` in the `templates` directory as the template for individual Markdown files.

For a full list of section variables, please see the [section](@/documentation/content/section.md) documentation. We will use *title = "List of blog posts"* in a template (see below).

### Templates

Let's now create some more templates. In the `templates` directory, create a `blog.html` file with the following contents:

```html
{% extends "base.html" %}

{% block content %}
<h1 class="title">
{{ section.title }}
</h1>
<ul>
{% for page in section.pages %}
<li><a href="{{ page.permalink }}">{{ page.title }}</a></li>
{% endfor %}
</ul>
{% endblock content %}
```

As done by `index.html`, `blog.html` extends `base.html`, but this time we want to list the blog posts. The *title* we set in the `_index.md` file above is available to us as `{{ section.title }}`. In the list below the title, we loop through all the pages in our section (`blog` directory) and output the page title and URL using `{{ page.title }}` and `{{ page.permalink }}`, respectively. If you go to <http://127.0.0.1:1111/blog/>, you will see the section page for `blog`. The list is empty because we don't have any blog posts. Let's fix that now.

### Markdown Content

In the `blog` directory, create a file called `first.md` with the following contents:

```md
+++
title = "My first post"
date = 2019-11-27
+++

This is my first blog post.
```

The *title* and *date* will be avaiable to us in the `blog-page.html` template as `{{ page.title }}` and `{{ page.date }}`, respectively. All text below the closing `+++` will be available to us as `{{ page.content }}`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The text below will be available as HTML

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"All text below the closing +++ will be available as HTML in the {{ page.content }} variable."? I'm currently using for directories and template variables names (TOML variables are in italics). Should I change to bold for template variables?


We now need to make the `blog-page.html` template. In the `templates` directory, create this file with the contents:

```html
{% extends "base.html" %}

{% block content %}
<h1 class="title">
{{ page.title }}
</h1>
<p class="subtitle"><strong>{{ page.date }}</strong></p>
<p>{{ page.content | safe }}</p>
{% endblock content %}
```

> Note the `| safe` filter for `{{ page.content }}`.

This should start to look familiar. If you now go back to our blog list page at <http://127.0.0.1:1111/blog/>, you should see our lonely post. Let's add another. In the `content/blog` directory, let's create the file `second.md` with the contents:

```md
+++
title = "My second post"
date = 2019-11-28
+++

This is my second blog post.
```

Back at <http://127.0.0.1:1111/blog/>, our second post shows up on top of the list because it's newer than the first post and we had set *sort_by = "date"* in our `_index.md` file. As a final step, let's modify our home page to link to our blog posts.

The `index.html` file inside the `templates` directory should be:

```html
{% extends "base.html" %}

{% block content %}
<h1 class="title">
This is my blog made with Zola.
</h1>
<p>Click <a href="/blog/">here</a> to see my posts.</p>
{% endblock content %}
```

This has been a quick overview of Zola. You can now dive into the rest of the documentation.