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.

overview.md 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. +++
  2. title = "Overview"
  3. weight = 10
  4. +++
  5. Zola uses the folder structure to determine the site structure.
  6. Each folder in the `content` directory represents a [section](@/documentation/content/section.md)
  7. that contains [pages](@/documentation/content/page.md): your `.md` files.
  8. ```bash
  9. .
  10. └── content
  11. ├── content
  12. │   └── something.md // -> https://mywebsite.com/content/something/
  13. ├── blog
  14. │   ├── cli-usage.md // -> https://mywebsite.com/blog/cli-usage/
  15. │   ├── configuration.md // -> https://mywebsite.com/blog/configuration/
  16. │   ├── directory-structure.md // -> https://mywebsite.com/blog/directory-structure/
  17. │   ├── _index.md // -> https://mywebsite.com/blog/
  18. │   └── installation.md // -> https://mywebsite.com/blog/installation/
  19. └── landing
  20. └── _index.md // -> https://mywebsite.com/landing/
  21. ```
  22. Each page path (the part after the `base_url`, for example `blog/cli-usage/`) can be customised by changing the `path` or `slug`
  23. attribute of the [page front-matter](@/documentation/content/page.md#front-matter).
  24. You might have noticed a file named `_index.md` in the example above.
  25. This file is used to store both metadata and content of the section itself and is not considered a page.
  26. To make sure the terminology used in the rest of the documentation is understood, let's go over the example above.
  27. The `content` directory in this case has three `sections`: `content`, `blog` and `landing`. The `content` section has only
  28. one page, `something.md`, the `landing` section has no page and the `blog` section has 4 pages: `cli-usage.md`, `configuration.md`, `directory-structure.md`
  29. and `installation.md`.
  30. While not shown in the example, sections can be nested indefinitely.
  31. ## Assets colocation
  32. The `content` directory is not limited to markup files though: it's natural to want to co-locate a page and some related
  33. assets, for instance images or spreadsheets. Zola supports that pattern out of the box for both sections and pages.
  34. Any non-markdown file you add in the page/section folder will be copied alongside the generated page when building the site,
  35. which allows us to use a relative path to access them.
  36. For pages to use assets colocation, they should not be placed directly in their section folder (such as `latest-experiment.md`), but as an `index.md` file
  37. in a dedicated folder (`latest-experiment/index.md`), like so:
  38. ```bash
  39. └── research
  40. ├── latest-experiment
  41. │ ├── index.md
  42. │ └── yavascript.js
  43. ├── _index.md
  44. └── research.jpg
  45. ```
  46. In this setup, you may access `research.jpg` from your 'research' section,
  47. and `yavascript.js` from your 'latest-experiment' directly within the Markdown:
  48. ```markdown
  49. Check out the complete program [here](yavascript.js). It's **really cool free-software**!
  50. ```
  51. By default, this page will get the folder name as its slug. So its permalink would be in the form of `https://example.com/research/latest-experiment/`
  52. ### Excluding files from assets
  53. It is possible to ignore selected asset files using the
  54. [ignored_content](@/documentation/getting-started/configuration.md) setting in the config file.
  55. For example, say you have an Excel spreadsheet from which you are taking several screenshots and
  56. then linking to those image files on your website. For maintainability purposes, you want to keep
  57. the spreadsheet in the same folder as the markdown, but you don't want to copy the spreadsheet to
  58. the public web site. You can achieve this by simply setting `ignored_content` in the config file:
  59. ```
  60. ignored_content = ["*.xlsx"]
  61. ```
  62. ## Static assets
  63. In addition to placing content files in the `content` directory, you may also place content
  64. files in the `static` directory. Any files/folders that you place in the `static` directory
  65. will be copied, without modification, to the public directory.
  66. Typically, you might put site-wide assets (such as the site favicon, site logos or site-wide
  67. JavaScript) in the root of the static directory. You can also place any HTML or other files that
  68. you wish to be included without modification (that is, without being parsed as Markdown files)
  69. into the static directory.
  70. Note that the static folder provides an _alternative_ to colocation. For example, imagine that you
  71. had the following directory structure (a simplified version of the structure presented above):
  72. ```bash
  73. .
  74. └── content
  75. └── blog
  76.    ├── configuration
  77. │    └── index.md // -> https://mywebsite.com/blog/configuration/
  78.    └── _index.md // -> https://mywebsite.com/blog/
  79. ```
  80. If you wanted to add an image to the `https://mywebsite.com/blog/configuration` page, you would
  81. have three options:
  82. * You could save the image to the `content/blog/configuration` folder and then link it with a
  83. relative path from the `index.md` page. This is the approach described under **colocation**,
  84. above.
  85. * You could save the image to a `static/blog/configuration` folder and link it in exactly the
  86. same way as if you had colocated it. If you do this, the generated files will be identical to
  87. if you had colocated; the only difference will be that all static files will be saved in the
  88. static folder rather than in the content folder. Depending on your organizational needs, this
  89. may be better or worse.
  90. * Or you could save the image to some arbitrary folder within the static folder. For example,
  91. you could save all images to `static/images`. Using this approach, you would no longer be able
  92. to use relative links, but could use an absolute link to `images/[filename]` to access your
  93. image. This might be preferable for small sites or for sites that associate images with
  94. multiple pages (e.g., logo images that appear on every page).