GithubHelp home page GithubHelp logo

TODO for 0.0.1 about zola HOT 3 CLOSED

getzola avatar getzola commented on July 17, 2024
TODO for 0.0.1

from zola.

Comments (3)

Keats avatar Keats commented on July 17, 2024

Pagination

A few cases to consider:

  • simple blog, with/without pagination
  • site: typically no pagination
  • site + blog: pagination on some bits only potentially (the blog)
  • random site with pagination on some sections (like a knowledge base for example)

Default is no pagination at all.

Then people can add paginations for whatever section they want. We need 3 elements for each pagination: (section_name, num_per_page, path_name).

Example of mixed site+blog content folder:

content
 - about.md
 - pricing.md
 - blog
   - article1.md
  • section_name: for example you can use blog and it will generate pagination for all the pages in blog. The only way I can see it working for the basic blog is to have a magic name, like base that will work on the first level in the content folder
  • num_per_page: how many pages on each page of the pagination
  • path_name: what goes in the url for the pagination. For example, if I use "page", the second page will be mysite.com/page/2

We can potentially have several type of contents needing pagination, but since I'm not using pagination at all myself, one basic level should be fine to start with.

from zola.

Keats avatar Keats commented on July 17, 2024

Sections

Each section should have an index page created automatically.
It should also contains the data of the child sections if possible so you can build some kind of layout like https://easyengine.io/tutorials/
The tricky thing: how to have different templates for different sections.

3 possible approaches, in order of preference:

Mapping in config

Something like

[[section_templates]]
name = "post"
template = "posts.html"

[[section_templates]]
name = "knowledge-base"
template = "kb.html"

The _index.md approach is the most flexible, and ensure those list appear in sitemap and can have titles/specific layouts

See http://bepsays.com/en/2016/12/19/hugo-018/ for details on how Hugo solved that

One important thing is how to differentiate post in a folder with a content from a section. Maybe only create a section when a file named _index.md is created? It's also more explicit this way: people can decide whether to have a section page or not rather than having one 100% of the time

Test site

.
└── posts
    ├── fixed-slug.md
    ├── fixed-url.md
    ├── _index.md
    ├── no-section
    │   └── simple.md
    ├── python.md
    ├── simple.md
    ├── tutorials
    │   ├── devops
    │   │   ├── docker.md
    │   │   ├── _index.md
    │   │   └── nix.md
    │   ├── _index.md
    │   └── programming
    │       ├── _index.md
    │       ├── python.md
    │       └── rust.md
    └── with-assets
        ├── index.md
        └── with.js

Only 4 sections (4 _index.md) but some are children of others.
We want to get the children section as well so when rendering the tutorials sections, we would have access to the the pages of devops and programming as well if we want to render some kind of TOC

from zola.

Keats avatar Keats commented on July 17, 2024

(Architecture) Design of Pages (Page, Section, RSS, Sitemap, Index)

Index

Nothing to do here, there's the index.html template and we can just pass all the site data

RSS/Sitemap

Very basic templates, nothing to do there it's already working ok

Page

The current design feels ok I think

Section

Having section as a Page is a bit annoying as they have very little in common. A section will only have a frontmatter and no content. We could have a enum with two variants: Page and Section but it doesn't seem worth the hassle.
Possible solution: a Section struct. When encountering a _index.md in parse_site, we could create a Section struct instead of a Page struct.
Section will only have as little info as required: a frontmatter, some path infos and 2 fields filled later: pages and subsections, pages only containing the immediate pages in that section.
This allows pages and sections to have different render_html methods and make it easier to handle things like sorting sections only, for example with a weight field.
The site would hold those Section and, when done with parsing, could populate the pages and subsections with the correct info. Rendering should be much easier if we have structs as well.

from zola.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.