summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Paul <n@nc0.fr>2023-04-26 21:08:50 +0200
committerNicolas Paul <n@nc0.fr>2023-04-26 21:08:50 +0200
commit8c79798252b6b09817c39b6988e096d014585455 (patch)
treec23842ce1dac481f9655bb3b7fe11b7661cd1197
parente41107499d44001bbe949693db9202ec2ce74a6a (diff)
Add documentation site
-rw-r--r--.gitignore3
-rw-r--r--README.md139
-rwxr-xr-xdoc/build.sh9
-rw-r--r--doc/src/.crocc.html65
-rw-r--r--doc/src/assets/crocodile.jpgbin0 -> 3902459 bytes
-rw-r--r--doc/src/assets/emoji_crocodile.pngbin0 -> 5594 bytes
-rw-r--r--doc/src/assets/emoji_crocodile.svg99
-rw-r--r--doc/src/doc/index.md23
-rw-r--r--doc/src/doc/iodir.md34
-rw-r--r--doc/src/doc/markdown.md51
-rw-r--r--doc/src/doc/template.md69
-rw-r--r--doc/src/index.md90
-rw-r--r--doc/src/robots.txt4
-rw-r--r--doc/src/sitemap.xml23
-rw-r--r--doc/src/style.css91
-rw-r--r--template.go2
16 files changed, 562 insertions, 140 deletions
diff --git a/.gitignore b/.gitignore
index e71b84d..fe45f46 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,4 +10,7 @@
crocc
/testdata/dst
+# Documentation build output
+doc/dst/
+
.DS_Store \ No newline at end of file
diff --git a/README.md b/README.md
index 9c1e47d..4c45f2f 100644
--- a/README.md
+++ b/README.md
@@ -6,144 +6,7 @@ generation tools such as Hugo or Jekyll.
Indeed, you only need Markdown to write content in a productive manner, and
everything else is standard scripts (JavaScript, CSS, images, etc.).
-## Usage
-
-Let's say you have a directory containing the following files:
-
-```
-src/
-├── .crocc.html
-├── index.md
-├── about.md
-├── bar.png
-└── contact.md
-```
-
-The `.crocc.html` file is the template used to generate the HTML pages.
-The `index.md`, `about.md` and `contact.md` files are Markdown documents.
-The `bar.png` file is a static file.
-
-To generate the HTML files, run the following command:
-
-```bash
-$ crocc -out=dst -url="http://example.com" src
-```
-
-The `dst` directory will contain the following files:
-
-```
-dst/
-├── index.html
-├── about.html
-├── bar.png
-└── contact.html
-```
-
-You can now upload the `dst` directory to your web server and you're done!
-
-## Documentation
-
-### Input/output directory
-
-The input directory is the directory containing the various files used to
-build the site.
-The input directory must contain a `.crocc.html` file, which is the
-template used to generate the HTML pages.
-
-> Only the top-level template is used. Nested templates are not supported.
-
-The output directory is the directory where the generated HTML files will be
-written.
-The output directory must not exist before running Crocc.
-
-Crocc will copy all the files in the input directory to the output directory,
-except the `.crocc.html` file.
-During the copy, Crocc will transform Markdown documents to HTML files.
-
-### Markdown document
-
-The Markdown document must have a YAML header, also known as "front matter".
-The YAML header is a set of key-value pairs separated by a colon.
-The YAML header is followed by the Markdown document.
-
-Front matter keys:
-* `title`: The title of the document. Required.
-* `description`: The description of the document. Required.
-* `publication_time`: The date of the document. Required.
-* `last_update_time`: The date of the last update of the document. Not required.
-* `keywords`: The tags of the document, as a list of strings. Required.
-* `author`: The author of the document. Default is `""`.
-* `hide`: If set to `true`, the document will not be generated.
-Default is `false`.
-
-Example:
-
-```md
----
-title: Hello World
-description: This is a simple example of a Markdown document.
-publication_time: 2020-01-01T00:00:00Z
-last_update_time: 2020-01-01T03:00:00Z
-keywords: [example, hello, world]
-author: John Doe
-hide: true
----
-
-# Hello World!
-```
-
-### Page template
-
-To create HTML pages, Crocc uses a template file.
-The template file, written in HTML using Go template syntax, must be located in
-the `$INPUT/.crocc.html` file.
-
-The template file is injected with a set of variables. A variable can be used
-in the template file using the `{{ .VariableName }}` syntax.
-Read the [Go template documentation](https: //golang.org/pkg/text/template) for
-more information.
-
-The following variables are available:
-* `.Title`: The title of the document.
-* `.Description`: The description of the document.
-* `.PublicationTime`: The date of the document.
-* `.LastUpdateTime`: The date of the last update of the document.
-* `.Keywords`: The tags of the document, as a string separated by commas.
-* `.Author`: The author of the document.
-* `.Content`: The content of the document, as HTML.
-* `.Site`: The URL of the site.
-* `.Generator`: A string containing the name and version of the generator.
-* `.Sitemap`: The URL of the sitemap.
-
-Here is a sample template:
-
-```html
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="utf-8">
- <title>{{ .Title }}</title>
- <meta name="description" content="{{ .Description }}">
- <meta name="keywords" content="{{ .Keywords }}">
- <meta name="author" content="{{ .Author }}">
- <meta name="generator" content="{{ .Generator }}">
- <meta name="viewport" content="width=device-width, initial-scale=1">
-</head>
-<body>
- <header>
- <h1>{{ .Title }}</h1>
- </header>
- <main>
- {{ .Content }}
- </main>
- <footer>
- <p>
- Last update: {{ .LastUpdateTime }}
- </p>
- </footer>
-</body>
-</html>
-```
+More information can be found on the [project's website](https://crocc.nc0.fr).
## License
diff --git a/doc/build.sh b/doc/build.sh
new file mode 100755
index 0000000..2881fa0
--- /dev/null
+++ b/doc/build.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+# Copyright (c) 2023 Nicolas Paul All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+
+
+set -e
+rm -rf doc/dst
+./crocc -out=doc/dst -url="https://crocc.nc0.fr" doc/src \ No newline at end of file
diff --git a/doc/src/.crocc.html b/doc/src/.crocc.html
new file mode 100644
index 0000000..574671d
--- /dev/null
+++ b/doc/src/.crocc.html
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<!--
+ Copyright (c) 2023 Nicolas Paul All rights reserved.
+ Use of this source code is governed by a BSD-style
+ license that can be found in the LICENSE file.
+-->
+
+<html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>{{ .Title }}</title>
+ <meta name="author" content="{{ .Author }}" />
+ <meta name="description" content="{{ .Description }}" />
+ <meta name="keywords" content="{{ .Keywords }}" />
+ <meta name="generator" content="{{ .Generator }}">
+ <meta name="color-scheme" content="light dark" />
+ <meta name="robots" content="all" />
+ <link rel="sitemap" href="/sitemap.xml" />
+ <meta name="twitter:card" content="summary_large_image" />
+ <meta name="twitter:site" content="@ncs_pl" />
+ <meta name="twitter:title" content="{{ .Title }}" />
+ <meta name="twitter:description" content="{{ .Description }}" />
+ <meta name="twitter:image" content="{{ .Site }}/assets/crocodile.jpg" />
+ <meta property="og:title" content="{{ .Title }}" />
+ <meta property="og:type" content="website" />
+ <meta property="og:url" content="{{ .Site }}" />
+ <meta property="og:description" content="{{ .Description }}" />
+ <meta property="og:determiner" content="" />
+ <meta property="og:locale" content="en" />
+ <meta property="og:site_name" content="Crocc" />
+ <meta property="og:image" content="{{ .Site }}/assets/crocodile.jpg" />
+ <link rel="stylesheet" href="/style.css">
+ <link rel="shortcut icon" href="assets/emoji_crocodile.svg"
+ type="image/svg">
+ <link rel="apple-touch-icon" href="assets/emoji_crocodile.png">
+ </head>
+ <body>
+ <header>
+ <nav>
+ <ul>
+ <li><strong>Crocc</strong></li>
+ <li><a href="/">Home</a></li>
+ <li>
+ <a href="https://github.com/n1c00o/crocc"
+ target="_blank">Source</a>
+ </li>
+ <li>
+ <a href="https://nc0.fr" target="_blank">Nicolas
+ Paul</a>
+ </li>
+ </ul>
+ </nav>
+ </header>
+ <main>
+ {{ .Content }}
+ </main>
+ <footer>
+ <hr />
+
+ <p>Copyright (c) 2023, Nicolas Paul</p>
+ </footer>
+ </body>
+</html> \ No newline at end of file
diff --git a/doc/src/assets/crocodile.jpg b/doc/src/assets/crocodile.jpg
new file mode 100644
index 0000000..297d4de
--- /dev/null
+++ b/doc/src/assets/crocodile.jpg
Binary files differ
diff --git a/doc/src/assets/emoji_crocodile.png b/doc/src/assets/emoji_crocodile.png
new file mode 100644
index 0000000..8f151c7
--- /dev/null
+++ b/doc/src/assets/emoji_crocodile.png
Binary files differ
diff --git a/doc/src/assets/emoji_crocodile.svg b/doc/src/assets/emoji_crocodile.svg
new file mode 100644
index 0000000..f9049ee
--- /dev/null
+++ b/doc/src/assets/emoji_crocodile.svg
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 24.1.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ viewBox="0 0 128 128" style="enable-background:new 0 0 128 128;" xml:space="preserve">
+<path style="fill:#5A6415;" d="M58.5,13.64l-18.96,10.7l-11.07,10.7l-9.03,1.75c0,0,3.52,3.94,13.76,0.6
+ c10.14-3.31,15.86-16.91,26.92-15.7c10.63,1.16,8.62,11.51,8.62,11.51l14.54-16.55L58.5,13.64z"/>
+<path style="fill:#5A6415;" d="M55.27,42.28c0,0-3.37,0.99-5.3,6.23c-1.5,4.07-0.52,8.02-0.09,9.57c0.42,1.55,1.49,3.66,1.56,4.5
+ c0.07,0.84-2.41,2.49-2.29,4.05c0.07,0.92,1.77,2.28,3.87,2.53c4.08,0.49,5-0.56,5-0.56l5.49-18.9L55.27,42.28z"/>
+<path style="fill:#5A6415;" d="M57.27,75.19c0,0-7.07-4.08-14.32-3.66s-9.29,3.8-10.14,6.69c-0.56,1.92-1.86,5.23-2.89,6.9
+ c-0.95,1.55-2.96,2.87-4.22,3.15c-1.81,0.4-4.05,1.16-3.33,3.94c0.59,2.28,2.25,3.71,4.29,5.05c2.01,1.31,4.38,2.82,4.38,2.82
+ l25.97-17.21L57.27,75.19z"/>
+<path style="fill:#5A6415;" d="M82.08,88.21l-5.91,7.81c0,0,2.32,4.65,8.09,5.98c5.77,1.34,8.76,1.69,9.54,3.55
+ c1.05,2.54-0.14,5.91-0.56,6.62c-0.42,0.7-2.62,3-1.02,4.58c1.94,1.9,7.18,0.77,9.01,0.14s4.13-1.11,4.94-3.78
+ c0.55-1.83,1.66-8.42,1.5-12.51c-0.18-4.75-1.06-7.92-2.53-9.26c-1.48-1.34-11.16-3.13-11.16-3.13s1.67-3.88,3.59-8.94
+ c0.95-2.5,1.51-5.17,1.97-5.35c0.73-0.28,1.94,1.69,2.22,2.46c0.28,0.77,0.14,8.47,1.19,9.62c0.89,0.98,3.83,1.62,6.52-0.18
+ c2.36-1.58,4.85-4.51,4.72-7.53c-0.18-3.91-3.77-6.76-3.91-8.31c-0.14-1.55,0.56-5.46,0-8.48c-0.56-3.03-15.03-12-15.03-12
+ L82.08,88.21z"/>
+<polyline style="fill:#F26A35;" points="56.04,101.72 22.67,110.73 18.17,111.79 18.31,116.36 26.83,121.99 46.54,116.15
+ 59.14,109.4 55.62,101.23 "/>
+<path style="fill:#FFFDFD;" d="M19.51,117.63c0,0,0.28-4.15,2.11-3.8c1.49,0.29,2.18,5.21,2.18,5.21l2.53,2.11l2.53-2.39
+ c0,0,1.27-4.93,2.75-5.07c1.69-0.16,2.82,4.43,2.82,4.43l-8.09,4.43L19.51,117.63z"/>
+<path style="fill:#FFFDFD;" d="M39.5,107.07c0,0,1.75,3.48,3.8,3.31c2.46-0.21,2.89-6.19,2.89-6.19L39.5,107.07z"/>
+<path style="fill:#70853C;" d="M35.13,92.36c-0.32,1.93-4.3,4.33-5.96,5.42c-2.06,1.36-4.46,3.17-6.01,3.24s-3.85,0.23-6.05,0.38
+ c-2.11,0.14-3.61,0.59-4.6,2.63c-0.73,1.51-0.89,5.02,0.8,6.71c1.69,1.69,5.42,3.17,10.42,2.53c5-0.63,6.55-1.48,8.17-2.18
+ c1.62-0.7,9.15-3.73,12.67-4.65c3.52-0.92,10.14-2.82,11.26-1.83c1.13,0.99-3.38,4.01-6.9,5.35c-3.52,1.34-13.97,7.32-18.11,8.45
+ c-2.95,0.8-9.22,0.36-10.75-1.06c-1.16-1.07-1.55-1.81-1.58-2.78c-0.04-0.97-1.11-1.32-2.08-0.32c-1.2,1.23,0.11,4.5,2.53,6.48
+ c2.41,1.95,6.47,3.09,12.48,2.67c8.17-0.56,15.65-5.84,17.41-5.91c1.76-0.07,7.5,0.85,12.95-1.31c5.6-2.22,8.35-6.43,8.35-6.43
+ s4.88-2.35,7.98-4.46c3.1-2.11,5.07-3.57,5.07-3.57s-2.72-1.6-2.79-5.49c-0.04-2.32,0.77-5.49,2.82-5.14
+ c2.04,0.35-1.48,5.49,2.32,7.32s10.35,3.87,13.87,1.83c3.52-2.04,7.15-7.31,5.96-9.07c-1.2-1.76-4.03-2.41-6.76-2.96
+ c-2.56-0.51-5.82-0.71-5.82-0.71s3.45-8.66,3.87-13.51c0.22-2.53,0.12-4.94-0.21-6.97c-0.42-2.6-1.09-5.83-1.06-8.24
+ c0.04-2.6,0.28-6.19,1.62-5.91c1.34,0.28,0.73,3.94,0.99,7.39c0.28,3.87,1.97,9.36,6.34,9.08c4.36-0.28,6.69-3.31,6.05-9.08
+ c-0.63-5.77-1.3-9.43-3.7-12.39c-2.39-2.96-5.03-3.55-5.03-3.55s-0.35-10.94-3.59-17.7C94.51,19.19,86.55,9.09,74.31,5.57
+ S53,5.46,46.68,9.3c-8.69,5.28-12.49,19.6-17.84,22.21s-9.68,2.5-9.75,3.98c-0.07,1.48,0.49,1.97,3.94,1.9
+ c3.45-0.07,6.99-0.63,11.54-3.87c5.38-3.84,12.74-12.74,18.3-14.78s11.54-1.41,14.36,1.62s3.66,6.43,2.99,9.15
+ c-1.11,4.52-4.4,7.39-4.4,7.39s-10.49,2.82-13.51,7.46s-2.15,6.72,0.14,8.59c3.67,2.99,8.59,1.48,8.59,1.48s-2.43,8.94-2.99,11.68
+ c-0.56,2.75-2.36,11.76-2.92,13.16c-0.56,1.41-1.27,4.5-3.17,4.43c-1.9-0.07-5.28-3.59-11.05-1.34
+ C35.68,84.4,35.56,89.83,35.13,92.36z"/>
+<path style="fill:#FFFDFD;" d="M52.13,103.69c-2.15,0.6-2.29,5.88-2.29,5.88s1.31-0.51,2.71-1.3c1.37-0.77,1.99-1.43,1.99-1.43
+ S53.46,103.32,52.13,103.69z"/>
+<path style="fill:#70853C;" d="M97.26,113.42c-1.48-0.11-2.11,1.31-2.44,2.76c-0.18,0.77-0.25,1.51-0.25,1.51s0.84,0.18,1.83,0.11
+ s1.9-0.21,1.9-0.21S99.31,113.57,97.26,113.42z"/>
+<path style="fill:#70853C;" d="M99.62,117.31c0,0-0.21-1.71,0.53-3.11c0.74-1.41,2.78-1.4,2.89,0.53c0.05,0.97-0.07,1.6-0.07,1.6
+ s-0.7,0.35-1.39,0.55C100.77,117.1,99.62,117.31,99.62,117.31z"/>
+<path style="fill:#71873B;" d="M105.45,82.93c-1.72,0.01-1.82,3.55-1.82,3.55s0.61,0.5,1.71,0.53c0.98,0.03,1.76-0.18,1.76-0.18
+ S107.36,82.92,105.45,82.93z"/>
+<path style="fill:#71873B;" d="M108.59,86.32c0,0-1.63-3.92,0.5-4.46c1.46-0.37,1.97,2.66,1.97,2.66s-0.46,0.58-1.06,0.99
+ C109.36,85.94,108.59,86.32,108.59,86.32z"/>
+<path style="fill:#70853C;" d="M49.67,67.65c0,0,1.36-3.22,2.73-2.52c1.44,0.74-0.39,3.82-0.39,3.82s-0.77-0.25-1.41-0.6
+ C50.16,68.11,49.67,67.65,49.67,67.65z"/>
+<path style="fill:#70853C;" d="M55.12,66c1.51,0.07,0.99,3.26,0.99,3.26s-0.65,0.07-1.34,0.05c-0.64-0.02-1.39-0.09-1.39-0.09
+ S53.78,65.94,55.12,66z"/>
+<path style="fill:#70853C;" d="M22.25,91.34c0,0,3.63-0.95,4.36,0.67c0.74,1.62-2.97,2.71-2.97,2.71s-0.76-0.96-1-1.62
+ C22.13,91.74,22.25,91.34,22.25,91.34z"/>
+<path style="fill:#70853C;" d="M24.86,95.93c-0.04-0.11,2.25-2.29,3.55-1.34s-0.81,3.24-0.81,3.24s-0.88-0.48-1.44-0.88
+ C25.48,96.47,24.86,95.93,24.86,95.93z"/>
+<path style="fill:#2E2C33;" d="M61.83,95.01c0.14,1.64-0.33,3.57-2.82,4.18c-2.26,0.56-4.55-0.89-4.6-3.33
+ c-0.05-2.35,1.79-4.04,3.8-4.04S61.66,93,61.83,95.01z"/>
+<path style="fill:#2E2C33;" d="M26.99,107.61c-0.09,1.17-1.1,1.49-1.83,1.41c-1.03-0.12-1.71-1.13-1.42-2.09
+ c0.27-0.93,1.21-1.36,2.01-1.11C26.54,106.06,27.07,106.61,26.99,107.61z"/>
+<path style="fill:#2E2C33;" d="M18.85,105.34c0.42,0.94-0.38,1.87-0.99,2.11c-0.82,0.33-1.91-0.04-2.18-1.01
+ c-0.26-0.93,0.31-1.79,1.12-2S18.44,104.42,18.85,105.34z"/>
+<path style="fill:#97A927;" d="M59.54,77.32c-0.68,2.26,0.08,3.65,0.41,4.38c0.66,1.45,1.7,1.4,2.55,0.74
+ c0.84-0.66-0.38-3,0.05-4.08c0.61-1.55,2.77-1.6,2.58-3.47c-0.14-1.4-2.01-1.7-3.33-0.56C60.83,75.14,59.99,75.79,59.54,77.32z"/>
+<path style="fill:#97A927;" d="M64.03,63.47c-0.95,2.35-0.35,4.24-0.07,4.93c0.46,1.13,2.57,1.48,2.78-0.39
+ c0.14-1.26-0.46-2.08,0.11-3.52c0.55-1.41,1.69-1.06,2.75-2.01c0.56-0.51,0.63-2.39-1.44-2.36C67.06,60.14,65.15,60.69,64.03,63.47z
+ "/>
+<path style="fill:#97A927;" d="M81.52,68.74c-0.42,2.15-0.07,3.52,0.35,4.26c0.42,0.74,2.18,1.26,2.67-0.35
+ c0.28-0.92-0.39-1.65,0.11-3.55c0.25-0.97,0.92-1.44,1.55-2.11c0.99-1.06-0.33-2.76-1.94-2.11C83.14,65.33,82.04,66.12,81.52,68.74z
+ "/>
+<path style="fill:#97A927;" d="M75.15,81.98c-0.88,1.58-0.72,3.36-0.56,4.4c0.32,2.15,2.46,2.11,2.71,0.88
+ c0.25-1.23-0.04-2.75,0.39-3.77s1.76-1.26,2.6-1.69c1.16-0.6,0.84-3.06-1.34-2.6C76.77,79.66,75.85,80.72,75.15,81.98z"/>
+<path style="fill:#97A927;" d="M85.5,52.73c-0.53,1.79-0.38,3.01-0.25,3.66c0.32,1.51,2.43,1.58,2.64,0.25
+ c0.21-1.34,0.14-2.08,0.39-2.92c0.41-1.39,0.76-1.63,1.37-2.29c1.09-1.16-0.25-2.99-1.9-2.01C86.8,49.99,85.9,51.37,85.5,52.73z"/>
+<path style="fill:#97A927;" d="M68.42,47.64c-0.91,1.76-0.69,3.66-0.55,4.59c0.15,0.92,0.62,1.78,1.64,1.7
+ c1.02-0.07,1.39-0.85,1.28-1.7c-0.06-0.44-0.29-1.89,0.18-2.89s1.41-1.6,2.15-1.89c1.83-0.7,0.75-3.34-1.35-2.63
+ C70.24,45.35,69.15,46.23,68.42,47.64z"/>
+<path style="fill:#97A927;" d="M75.19,33.94c-1.32,1.42-1.39,3.14-1.3,4.36c0.18,2.43,2.43,2.04,2.71,0.67
+ c0.19-0.92,0.39-2.18,0.67-2.82c0.56-1.27,1.51-2.04,0.77-2.82C77.37,32.64,76.07,32.99,75.19,33.94z"/>
+<path style="fill:#97A927;" d="M87.79,37.19c-0.12,2.11,0.23,2.97,0.76,3.94c0.76,1.39,2.71,1.04,2.82-0.6
+ c0.08-1.19-0.48-0.91-0.36-3.22c0.08-1.46,0.87-2.86-0.2-3.38C89.75,33.41,87.99,33.69,87.79,37.19z"/>
+<path style="fill:#97A927;" d="M84.51,20.95c0.6,1.02,1.37,1.9,1.65,3.31c0.39,1.94,2.93,1.48,2.96-0.28
+ c0.04-2.36-0.7-3.41-1.55-4.47c-0.82-1.02-2.15-1.06-2.71-0.67S84,20.08,84.51,20.95z"/>
+<path style="fill:#97A927;" d="M74.84,21.81c-0.64,0.54-0.87,1.62-0.23,2.42c0.84,1.04,1.31,1.89,1.26,2.76
+ c-0.08,1.39,1.17,1.9,1.97,1.32c1.07-0.78,1.44-2.24,0.42-4.53C77.3,21.64,75.57,21.18,74.84,21.81z"/>
+<path style="fill:#97A927;" d="M72.09,9.52c-0.31,0.98,0.73,1.34,1.77,1.52c1.04,0.18,2.24,0.96,2.59,1.73
+ c0.49,1.08,2.03,1.67,2.36-0.02c0.29-1.45-1.56-2.95-2.7-3.61C75.18,8.59,72.63,7.82,72.09,9.52z"/>
+<path style="fill:#97A927;" d="M69.8,13.81c-1.58-0.89-4.32-0.81-4.65,0.7c-0.35,1.65,1.16,1.6,1.83,1.65
+ c0.88,0.07,1.72,0.32,2.25,0.95c0.53,0.63,0.92,1.34,2.01,1.02C72.33,17.82,72.55,15.35,69.8,13.81z"/>
+<path style="fill:#97A927;" d="M64.38,8.6c0.46-0.58,0.32-2.29-2.78-2.43c-2.59-0.12-3.26,1.12-2.85,1.9
+ c0.53,1.02,1.82,0.31,2.89,0.42C62.94,8.63,63.82,9.3,64.38,8.6z"/>
+<path style="fill:#97A927;" d="M57.87,11.66c-1.79-0.21-3.78,0.87-3.38,2.43c0.32,1.23,1.79-0.1,2.96-0.07
+ c1.41,0.04,2.65,0.9,3.06,0.07C61.11,12.89,60.33,11.95,57.87,11.66z"/>
+<path style="fill:#97A927;" d="M51.51,9.55c-0.03,1.2-1.15,0.85-2.53,1.37c-0.84,0.32-1.63,1.83-2.42,1.17
+ c-1.06-0.89-0.09-2.31,1.5-3.13C49.21,8.35,51.55,8.28,51.51,9.55z"/>
+<path style="fill:#97A927;" d="M46.66,14.87c-2.35,1.15-2.96,4.01-1.79,4.52c1.42,0.62,1.39-1.5,2.61-2.28
+ c0.97-0.61,3.23-0.29,3.21-1.67C50.67,14.06,48.08,14.18,46.66,14.87z"/>
+<path style="fill:#97A927;" d="M42.28,22.6c0.26-0.91-1.55-2.15-3.7-0.7s-2.3,3.57-0.92,3.87c0.99,0.21,1.06-1.29,1.9-1.94
+ C40.76,22.92,41.93,23.84,42.28,22.6z"/>
+</svg>
diff --git a/doc/src/doc/index.md b/doc/src/doc/index.md
new file mode 100644
index 0000000..21a70fb
--- /dev/null
+++ b/doc/src/doc/index.md
@@ -0,0 +1,23 @@
+---
+title: Documentation
+description: Crocc is a simple and fast static-site generator based on Markdown.
+keywords:
+ - crocc
+ - markdown
+ - html
+ - go
+ - golang
+ - static
+ - site
+ - generator
+ - ssg
+ - website
+ - simple
+publication_time: 2023-04-26T19:00:00Z
+author: Nicolas Paul <n@nc0.fr>
+---
+# Documentation
+
+- [Markdown syntax](/doc/markdown)
+- [Template syntax](/doc/template)
+- [Input/output directory](/doc/iodir.md)
diff --git a/doc/src/doc/iodir.md b/doc/src/doc/iodir.md
new file mode 100644
index 0000000..6010ad4
--- /dev/null
+++ b/doc/src/doc/iodir.md
@@ -0,0 +1,34 @@
+---
+title: Input/output directory
+description: Crocc is a simple and fast static-site generator based on Markdown.
+keywords:
+ - crocc
+ - markdown
+ - html
+ - go
+ - golang
+ - static
+ - site
+ - generator
+ - ssg
+ - website
+ - simple
+publication_time: 2023-04-26T19:00:00Z
+author: Nicolas Paul <n@nc0.fr>
+---
+# Input/output directory
+
+The input directory is the directory containing the various files used to
+build the site.
+The input directory must contain a `.crocc.html` file, which is the
+template used to generate the HTML pages.
+
+> Only the top-level template is used. Nested templates are not supported.
+
+The output directory is the directory where the generated HTML files will be
+written.
+The output directory must not exist before running Crocc.
+
+Crocc will copy all the files in the input directory to the output directory,
+except the `.crocc.html` file.
+During the copy, Crocc will transform Markdown documents to HTML files. \ No newline at end of file
diff --git a/doc/src/doc/markdown.md b/doc/src/doc/markdown.md
new file mode 100644
index 0000000..37a62b3
--- /dev/null
+++ b/doc/src/doc/markdown.md
@@ -0,0 +1,51 @@
+---
+title: Markdown syntax
+description: Crocc is a simple and fast static-site generator based on Markdown.
+keywords:
+ - crocc
+ - markdown
+ - html
+ - go
+ - golang
+ - static
+ - site
+ - generator
+ - ssg
+ - website
+ - simple
+publication_time: 2023-04-26T19:00:00Z
+author: Nicolas Paul <n@nc0.fr>
+---
+# Markdown document
+
+The Markdown document must have a YAML header, also known as "front matter".
+The YAML header is a set of key-value pairs separated by a colon.
+The YAML header is followed by the Markdown document.
+
+Front matter keys:
+
+- `title`: The title of the document. Required.
+- `description`: The description of the document. Required.
+- `publication_time`: The date of the document. Required.
+- `last_update_time`: The date of the last update of the document. Not required.
+- `keywords`: The tags of the document, as a list of strings. Required.
+- `author`: The author of the document. Default is `""`.
+- `hide`: If set to `true`, the document will not be generated.
+ Default is `false`.
+
+Example:
+
+```md
+---
+title: Hello World
+description: This is a simple example of a Markdown document.
+publication_time: 2020-01-01T00:00:00Z
+last_update_time: 2020-01-01T03:00:00Z
+keywords: [example, hello, world]
+author: John Doe
+hide: true
+---
+# Hello World!
+
+This is a simple example of a Markdown document.
+``` \ No newline at end of file
diff --git a/doc/src/doc/template.md b/doc/src/doc/template.md
new file mode 100644
index 0000000..522afd6
--- /dev/null
+++ b/doc/src/doc/template.md
@@ -0,0 +1,69 @@
+---
+title: Template file
+description: Crocc is a simple and fast static-site generator based on Markdown.
+keywords:
+ - crocc
+ - markdown
+ - html
+ - go
+ - golang
+ - static
+ - site
+ - generator
+ - ssg
+ - website
+ - simple
+publication_time: 2023-04-26T19:00:00Z
+author: Nicolas Paul <n@nc0.fr>
+---
+# Template file
+
+To create HTML pages, Crocc uses a template file.
+The template file, written in HTML using Go template syntax, must be located in
+the `$INPUT/.crocc.html` file.
+
+The template file is injected with a set of variables. A variable can be used
+in the template file using the `{{ .VariableName }}` syntax.
+Read the [Go template documentation](https: //golang.org/pkg/text/template) for
+more information.
+
+The following variables are available:
+* `.Title`: The title of the document.
+* `.Description`: The description of the document.
+* `.PublicationTime`: The date of the document.
+* `.LastUpdateTime`: The date of the last update of the document.
+* `.Keywords`: The tags of the document, as a string separated by commas.
+* `.Author`: The author of the document.
+* `.Content`: The content of the document, as HTML.
+* `.Site`: The URL of the site.
+* `.Generator`: A string containing the name and version of the generator.
+
+Here is a sample template:
+
+```html
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>{{ .Title }}</title>
+ <meta name="description" content="{{ .Description }}">
+ <meta name="keywords" content="{{ .Keywords }}">
+ <meta name="author" content="{{ .Author }}">
+ <meta name="generator" content="{{ .Generator }}">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+</head>
+<body>
+ <header>
+ <h1>{{ .Title }}</h1>
+ </header>
+ <main>
+ {{ .Content }}
+ </main>
+ <footer>
+ <p>
+ Last update: {{ .LastUpdateTime }}
+ </p>
+ </footer>
+</body>
+</html>
+``` \ No newline at end of file
diff --git a/doc/src/index.md b/doc/src/index.md
new file mode 100644
index 0000000..b5ce035
--- /dev/null
+++ b/doc/src/index.md
@@ -0,0 +1,90 @@
+---
+title: Crocc
+description: Crocc is a simple and fast static-site generator based on Markdown.
+keywords:
+ - crocc
+ - markdown
+ - html
+ - go
+ - golang
+ - static
+ - site
+ - generator
+ - ssg
+ - website
+ - simple
+publication_time: 2023-04-26T19:05:00Z
+author: Nicolas Paul <n@nc0.fr>
+---
+# Crocc
+
+Crocc is a simple static-site generator based on Markdown.
+The main goal of Crocc is to offer simplicity, as opposed to other static-site
+generation tools such as Hugo or Jekyll.
+Indeed, you only need Markdown to write content in a productive manner, and
+everything else is standard scripts (JavaScript, CSS, images, etc.).
+
+![A crocodile walking](/assets/crocodile.jpg)
+
+## Installation
+
+To install Crocc from sources, you need to have Go installed on your system.
+Then, run the following command:
+
+```bash
+$ go install go.nc0.fr/crocc@latest
+```
+
+> Note: You can replace `latest` with a specific Git commit.
+
+## Usage
+
+Let's say you have a directory containing the following files:
+
+```
+src/
+├── .crocc.html
+├── index.md
+├── about.md
+├── bar.png
+└── contact.md
+```
+
+The `.crocc.html` file is the template used to generate the HTML pages.
+The `index.md`, `about.md` and `contact.md` files are Markdown documents.
+The `bar.png` file is a static file.
+
+To generate the HTML files, run the following command:
+
+```bash
+$ crocc -out=dst -url="http://example.com" src
+```
+
+The `dst` directory will contain the following files:
+
+```
+dst/
+├── index.html
+├── about.html
+├── bar.png
+└── contact.html
+```
+
+You can now upload the `dst` directory to your web server and you're done!
+
+## Documentation
+
+See the [documentation](/doc) for more information.
+
+## License
+
+The project is governed by a BSD-style license that can be found in the
+[LICENSE](https://github.com/n1c00o/crocc/blob/master/LICENSE) file.
+
+The banner image is a [photo](https://unsplash.com/photos/R3sgrDvXz3I) from
+[Unsplash](https://unsplash.com/) by
+[Thomas Couillard](https://unsplash.com/@thomascouillard).
+
+Favicons are Noto emojis and are licensed under the
+[Apache License 2.0](https://github.com/googlefonts/noto-emoji/blob/main/LICENSE)
+license.
diff --git a/doc/src/robots.txt b/doc/src/robots.txt
new file mode 100644
index 0000000..c699321
--- /dev/null
+++ b/doc/src/robots.txt
@@ -0,0 +1,4 @@
+User-Agent: *
+Allow: /
+
+Sitemap: https://crocc.nc0.fr/sitemap.xml
diff --git a/doc/src/sitemap.xml b/doc/src/sitemap.xml
new file mode 100644
index 0000000..b9557a6
--- /dev/null
+++ b/doc/src/sitemap.xml
@@ -0,0 +1,23 @@
+<!--
+ Copyright (c) 2023 Nicolas Paul All rights reserved.
+ Use of this source code is governed by a BSD-style
+ license that can be found in the LICENSE file.
+-->
+
+<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
+ <url>
+ <loc>https://crocc.nc0.fr/</loc>
+ </url>
+ <url>
+ <loc>https://crocc.nc0.fr/doc</loc>
+ </url>
+ <url>
+ <loc>https://crocc.nc0.fr/doc/iodir</loc>
+ </url>
+ <url>
+ <loc>https://crocc.nc0.fr/doc/markdown</loc>
+ </url>
+ <url>
+ <loc>https://crocc.nc0.fr/doc/template</loc>
+ </url>
+</urlset> \ No newline at end of file
diff --git a/doc/src/style.css b/doc/src/style.css
new file mode 100644
index 0000000..b8dfd9f
--- /dev/null
+++ b/doc/src/style.css
@@ -0,0 +1,91 @@
+/**
+ * Copyright (c) 2023 Nicolas Paul All rights reserved.
+ * Use of this source code is governed by a BSD-style
+ * license that can be found in the LICENSE file.
+ */
+
+/* TODO: Replace it with future common CSS */
+
+:root {
+ --background-color: #FFFFFF;
+ --text-color: #000000;
+ --accent-color: #155eca;
+}
+
+/* Auto Dark Theme */
+@media (prefers-color-scheme: dark) {
+ :root {
+ --background-color: #000000;
+ --text-color: #FFFFFF;
+ --accent-color: #648fd0;
+ }
+}
+
+html {
+ background-color: var(--background-color);
+ color: var(--text-color);
+ font-family: sans-serif;
+ margin: 0.6rem;
+}
+
+main {
+ padding-top: 1rem;
+ padding-bottom: 3rem;
+}
+
+h1,
+h2,
+h3,
+h4,
+h5,
+h6,
+p,
+blockquote {
+ max-width: 80ch;
+ line-height: 150%;
+}
+
+code,
+kbd,
+samp,
+pre {
+ font-family: monospace;
+}
+
+a {
+ color: var(--accent-color);
+}
+
+img {
+ width: 100%;
+ height: auto;
+}
+
+strong {
+ font-weight: bold;
+}
+
+em {
+ font-style: italic;
+}
+
+hr {
+ border: 0;
+ border-top: 1px solid var(--accent-color);
+}
+
+td {
+ max-width: 80ch;
+ padding: 0 15px;
+}
+
+/* Navigation Bar and Footer */
+header ul,
+footer ul {
+ list-style-type: none;
+ display: inline-flex;
+ gap: 1rem;
+ flex-wrap: wrap;
+ align-items: center;
+ padding-left: 0;
+} \ No newline at end of file
diff --git a/template.go b/template.go
index 8bca4fd..fef5e0f 100644
--- a/template.go
+++ b/template.go
@@ -23,7 +23,6 @@ type TemplateData struct {
Content string
Site string
Generator string
- Sitemap string
}
// GenerateHTML generates the HTML file from the Markdown document.
@@ -40,6 +39,5 @@ func GenerateHTML(file io.Writer, fm FrontMatter, content string) error {
Content: content,
Site: *url,
Generator: fmt.Sprintf("crocc %s (https://crocc.nc0.fr)", version),
- Sitemap: fmt.Sprintf("%s/sitemap.xml", *url),
})
}