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.3KB

6 years ago
6 years ago
6 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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`, then it will generate a page
  8. with the name of the containing folder (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 the prior part of this documentation. But 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`). So naming a file in the root of your
  15. content directory `about.md` would also create a page at `[base_url]/about`.
  16. Another exception to that rule is that a filename starting with a datetime (YYYY-mm-dd or [a 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 a filename like `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 exactly equivalent to creating an
  22. `about/index.md` file. The only difference between the two methods is that creating
  23. the `about` folder allows you to use asset colocation, as discussed in the
  24. [Overview](@/documentation/content/overview.md#assets-colocation) section of this documentation.
  25. ## Front-matter
  26. The front-matter is a set of metadata embedded in a file. In Zola,
  27. it is at the beginning of the file, surrounded by `+++` and uses TOML.
  28. While none of the front-matter variables are mandatory, the opening and closing `+++` are required.
  29. Here is an example page with all the variables available. The values provided below are the default
  30. values.
  31. ```md
  32. +++
  33. title = ""
  34. description = ""
  35. # The date of the post.
  36. # 2 formats are allowed: YYYY-MM-DD (2012-10-02) and RFC3339 (2002-10-02T15:00:00Z)
  37. # Do not wrap dates in quotes, the line below only indicates that there is no default date.
  38. # If the section variable `sort_by` is set to `date`, then any page that lacks a `date`
  39. # will not be rendered.
  40. # Setting this overrides a date set in the filename.
  41. date =
  42. # The weight as defined in the Section page
  43. # If the section variable `sort_by` is set to `weight`, then any page that lacks a `weight`
  44. # will not be rendered.
  45. weight = 0
  46. # A draft page will not be present in prev/next pagination
  47. draft = false
  48. # If filled, it will use that slug instead of the filename to make up the URL
  49. # It will still use the section path though
  50. slug = ""
  51. # The path the content will appear at
  52. # If set, it cannot be an empty string and will override both `slug` and the filename.
  53. # The sections' path won't be used.
  54. # It should not start with a `/` and the slash will be removed if it does
  55. path = ""
  56. # Use aliases if you are moving content but want to redirect previous URLs to the
  57. # current one. This takes an array of path, not URLs.
  58. aliases = []
  59. # Whether the page should be in the search index. This is only used if
  60. # `build_search_index` is set to true in the config and the parent section
  61. # hasn't set `in_search_index` to false in its front-matter
  62. in_search_index = true
  63. # Template to use to render this page
  64. template = "page.html"
  65. # The taxonomies for that page. The keys need to be the same as the taxonomies
  66. # name configured in `config.toml` and the values an array of String like
  67. # tags = ["rust", "web"]
  68. [taxonomies]
  69. # Your own data
  70. [extra]
  71. +++
  72. Some content
  73. ```
  74. ## Summary
  75. You can ask Zola to create a summary if you only want to show the first
  76. paragraph of each page in a list for example.
  77. To do so, add <code>&lt;!-- more --&gt;</code> in your content at the point
  78. where you want the summary to end and the content up to that point will be also
  79. available separately in the
  80. [template](@/documentation/templates/pages-sections.md#page-variables).
  81. An anchor link to this position named `continue-reading` is created, wrapped in a paragraph
  82. with a `zola-continue-reading` id, so you can link directly to it if needed for example:
  83. `<a href="{{ page.permalink }}#continue-reading">Continue Reading</a>`