You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

page.md 4.4KB

6 years ago
6 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. +++
  2. title = "Page"
  3. weight = 30
  4. +++
  5. A page is any file ending with `.md` in the `content` directory, except files
  6. named `_index.md`.
  7. If a file ending with `.md` is named `index.md`, it will generate a page
  8. with the name of its directory (for example, `/content/about/index.md` would
  9. create a page at `[base_url]/about`). (Note the lack of an underscore; if the file
  10. were named `_index.md`, then it would create a **section** at `[base_url]/about`, as
  11. discussed in a previous part of this documentation. In contrast, naming the file `index.md` will
  12. create a **page** at `[base_url]/about`).
  13. If the file is given any name *other* than `index.md` or `_index.md`, then it will
  14. create a page with that name (without the `.md`). For example, naming a file in the root of your
  15. content directory `about.md` would create a page at `[base_url]/about`.
  16. Another exception to this rule is that a filename starting with a datetime (YYYY-mm-dd or [an RFC3339 datetime](https://www.ietf.org/rfc/rfc3339.txt)) followed by
  17. an underscore (`_`) or a dash (`-`) will use that date as the page date, unless already set
  18. in the front matter. The page name will be anything after `_`/`-`, so the file `2018-10-10-hello-world.md` will
  19. be available at `[base_url]/hello-world`. Note that the full RFC3339 datetime contains colons, which is not a valid
  20. character in a filename on Windows.
  21. As you can see, creating an `about.md` file is equivalent to creating an
  22. `about/index.md` file. The only difference between the two methods is that creating
  23. the `about` directory allows you to use asset co-location, as discussed in the
  24. [overview](@/documentation/content/overview.md#asset-colocation) section.
  25. ## Front matter
  26. The TOML front matter is a set of metadata embedded in a file at the beginning of the file enclosed
  27. by triple pluses (`+++`).
  28. Although none of the front matter variables are mandatory, the opening and closing `+++` are required.
  29. Here is an example page with all the available variables. The values provided below are the
  30. default values.
  31. ```toml
  32. title = ""
  33. description = ""
  34. # The date of the post.
  35. # Two formats are allowed: YYYY-MM-DD (2012-10-02) and RFC3339 (2002-10-02T15:00:00Z).
  36. # Do not wrap dates in quotes; the line below only indicates that there is no default date.
  37. # If the section variable `sort_by` is set to `date`, then any page that lacks a `date`
  38. # will not be rendered.
  39. # Setting this overrides a date set in the filename.
  40. date =
  41. # The weight as defined on the Section page of the documentation.
  42. # If the section variable `sort_by` is set to `weight`, then any page that lacks a `weight`
  43. # will not be rendered.
  44. weight = 0
  45. # A draft page is only loaded if the `--drafts` flag is passed to `zola build`, `zola serve` or `zola check`.
  46. draft = false
  47. # If set, this slug will be instead of the filename to make the URL.
  48. # The section path will still be used.
  49. slug = ""
  50. # The path the content will appear at.
  51. # If set, it cannot be an empty string and will override both `slug` and the filename.
  52. # The sections' path won't be used.
  53. # It should not start with a `/` and the slash will be removed if it does.
  54. path = ""
  55. # Use aliases if you are moving content but want to redirect previous URLs to the
  56. # current one. This takes an array of paths, not URLs.
  57. aliases = []
  58. # When set to "true", the page will be in the search index. This is only used if
  59. # `build_search_index` is set to "true" in the Zola configuration and the parent section
  60. # hasn't set `in_search_index` to "false" in its front matter.
  61. in_search_index = true
  62. # Template to use to render this page.
  63. template = "page.html"
  64. # The taxonomies for this page. The keys need to be the same as the taxonomy
  65. # names configured in `config.toml` and the values are an array of String objects. For example,
  66. # tags = ["rust", "web"].
  67. [taxonomies]
  68. # Your own data.
  69. [extra]
  70. ```
  71. ## Summary
  72. You can ask Zola to create a summary if, for example, you only want to show the first
  73. paragraph of the page content in a list.
  74. To do so, add <code>&lt;!-- more --&gt;</code> in your content at the point
  75. where you want the summary to end. The content up to that point will be
  76. available separately in the
  77. [template](@/documentation/templates/pages-sections.md#page-variables).
  78. An anchor link to this position named `continue-reading` is created, wrapped in a paragraph
  79. with a `zola-continue-reading` id, so you can link directly to it if needed. For example:
  80. `<a href="{{ page.permalink }}#continue-reading">Continue Reading</a>`.