|
1 | 1 | Examples |
2 | 2 | ======== |
3 | 3 |
|
4 | | -Examples are available in the `genja <https://github.com/wigging/genja>`_ repository on GitHub. See the sections below for more information about each example. |
5 | | - |
6 | | -Building the examples |
7 | | ---------------------- |
8 | | - |
9 | | -The examples are located in the **genja/examples** directory in the GitHub repository. Use the ``genja build`` or ``genja serve`` command to generate the HTML for a particular example. For instance, use the commands shown below to build the website and run a local server for the **directory-nocat** example. The example website will automatically reload in the web browser when changes are saved to the Markdown files. |
| 4 | +Examples are available in the **genja/examples** directory in the genja `GitHub <https://github.com/wigging/genja>`_ repository. Use the ``genja build`` or ``genja serve`` command to generate the HTML for a particular example. For instance, use the command shown below to build the website and run a local server for the **directory-output** example. The website will automatically reload in the web browser when changes are saved to the Markdown files. |
10 | 5 |
|
11 | 6 | .. code:: text |
12 | 7 |
|
13 | | - cd examples/directory-nocat |
| 8 | + cd examples/directory-output |
14 | 9 | genja serve |
15 | 10 |
|
16 | | -Use the commands shown below to build the example website without starting a local server. |
| 11 | +Alternatively, use the build command to build the website without starting a local server. |
17 | 12 |
|
18 | 13 | .. code:: text |
19 | 14 |
|
20 | | - cd examples/directory-nocat |
| 15 | + cd examples/directory-output |
21 | 16 | genja build |
22 | 17 |
|
23 | | -Directory output with no categories |
24 | | ------------------------------------ |
| 18 | +Code blocks |
| 19 | +----------- |
25 | 20 |
|
26 | | -The **directory-nocat** example uses the **mysite** directory for the generated HTML output. The Markdown files are located in the **_pages** and **_posts** directories. The Markdown files are not organized into categories using sub-directories. The **_templates** directory contains the Jinja templates. |
| 21 | +The code-blocks example demonstrates the use of `highlight.js <https://highlightjs.org>`_ to provide syntax coloring of code that is rendered in pages and posts. |
27 | 22 |
|
28 | | -.. code:: text |
| 23 | +Directory output |
| 24 | +---------------- |
29 | 25 |
|
30 | | - directory-nocat/ |
31 | | - ├── mysite/ |
32 | | - │ ├── img/ |
33 | | - │ └── styles.css |
34 | | - ├── _pages/ |
35 | | - │ ├── about.md |
36 | | - │ └── contact.md |
37 | | - ├── _posts/ |
38 | | - │ ├── apple.md |
39 | | - │ └── orange.md |
40 | | - ├── _templates/ |
41 | | - │ ├── index.html |
42 | | - │ ├── page.html |
43 | | - │ └── post.html |
44 | | - └── genja.toml |
45 | | -
|
46 | | -Directory output with categories |
47 | | --------------------------------- |
48 | | - |
49 | | -The **directory-withcat** example uses the **mysite** directory for the generated HTML output. The Markdown files are located in the **_pages** and **_posts** directories. The Markdown files are organized into categories using sub-directories. The **_templates** directory contains the Jinja templates. |
| 26 | +The directory-output example defines ``site_output = "mysite"`` in the ``genja.toml`` file. This tells Genja to output the generated content to the ``mysite`` directory in the project. |
50 | 27 |
|
51 | 28 | .. code:: text |
52 | 29 |
|
53 | | - directory-withcat/ |
54 | | - ├── mysite/ |
55 | | - │ ├── img/ |
56 | | - │ └── styles.css |
| 30 | + directory-output/ |
57 | 31 | ├── _pages/ |
58 | | - │ ├── about.md |
59 | | - │ └── contact.md |
60 | 32 | ├── _posts/ |
61 | | - │ ├── fruits/ |
62 | | - │ └── veggies/ |
63 | 33 | ├── _templates/ |
64 | | - │ ├── index.html |
65 | | - │ ├── page.html |
66 | | - │ └── post.html |
| 34 | + ├── mysite/ <-- output from Genja will go in this directory |
67 | 35 | └── genja.toml |
68 | 36 |
|
69 | | -Top-level output with no categories |
70 | | ------------------------------------ |
| 37 | +HTML content |
| 38 | +------------ |
71 | 39 |
|
72 | | -The **toplevel-nocat** example uses the root directory for the generated HTML output. The Markdown files are located in the **_pages** and **_posts** directories. The Markdown files are not organized into categories using sub-directories. The **_templates** directory contains the Jinja templates. |
| 40 | +The ``html-content`` example demonstrates putting HTML in the Markdown file. |
73 | 41 |
|
74 | | -.. code:: text |
| 42 | +Image files |
| 43 | +----------- |
75 | 44 |
|
76 | | - toplevel-nocat/ |
77 | | - ├── img/ |
78 | | - │ └── apple.jpg |
79 | | - ├── _pages/ |
80 | | - │ ├── about.md |
81 | | - │ └── contact.md |
82 | | - ├── _posts/ |
83 | | - │ ├── apple.md |
84 | | - │ └── orange.md |
85 | | - ├── _templates/ |
86 | | - │ ├── index.html |
87 | | - │ ├── page.html |
88 | | - │ └── post.html |
89 | | - ├── genja.toml |
90 | | - └── styles.css |
| 45 | +The ``image-files`` example shows how to embed images in the Markdown file. |
91 | 46 |
|
92 | | -Top-level output with no pages |
93 | | ------------------------------- |
| 47 | +Pages and posts |
| 48 | +--------------- |
94 | 49 |
|
95 | | -The **toplevel-nopages** example uses the root directory for the generated HTML output. The Markdown files are located in the **_posts** directory, there is no **_pages** directory for this example. The Markdown files are not organized into categories using sub-directories. The **_templates** directory contains the Jinja templates. |
| 50 | +The ``pages-and-posts`` examples demonstrates creating pages and posts as Markdown files. |
96 | 51 |
|
97 | | -.. code:: text |
98 | | -
|
99 | | - toplevel-nopages/ |
100 | | - ├── img/ |
101 | | - │ └── apple.jpg |
102 | | - ├── _posts/ |
103 | | - │ ├── apple.md |
104 | | - │ └── orange.md |
105 | | - ├── _templates/ |
106 | | - │ ├── index.html |
107 | | - │ └── post.html |
108 | | - ├── genja.toml |
109 | | - └── styles.css |
| 52 | +Root output |
| 53 | +----------- |
110 | 54 |
|
111 | | -Top-level output with categories |
112 | | --------------------------------- |
| 55 | +The ``root-output`` example generates the HTML website content at the root level of the project. |
113 | 56 |
|
114 | | -The **toplevel-withcat** example uses the root directory for the generated HTML output. The Markdown files are located in the **_pages** and **_posts** directories. The Markdown files are organized into categories using sub-directories. The **_templates** directory contains the Jinja templates. |
| 57 | +Sort posts |
| 58 | +---------- |
115 | 59 |
|
116 | | -.. code:: text |
| 60 | +The ``sort-posts`` example sorts the posts. |
117 | 61 |
|
118 | | - toplevel-withcat/ |
119 | | - ├── img/ |
120 | | - │ └── apple.jpg |
121 | | - ├── _pages/ |
122 | | - │ ├── about.md |
123 | | - │ └── contact.md |
124 | | - ├── _posts/ |
125 | | - │ ├── fruits/ |
126 | | - │ └── veggies/ |
127 | | - ├── _templates/ |
128 | | - │ ├── index.html |
129 | | - │ ├── page.html |
130 | | - │ └── post.html |
131 | | - ├── genja.toml |
132 | | - └── styles.css |
0 commit comments