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 3.7KB

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