Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enhance blog-aware rules to handle more use cases (blog, docs...) #5

Closed
frouo opened this issue Mar 21, 2022 · 1 comment · Fixed by #17
Closed

feat: enhance blog-aware rules to handle more use cases (blog, docs...) #5

frouo opened this issue Mar 21, 2022 · 1 comment · Fixed by #17
Labels
enhancement New feature or request

Comments

@frouo
Copy link
Owner

frouo commented Mar 21, 2022

Purpose

Allow to customize the YYYY-MM-DD rule for given folder.

Thus allowing specified folder to have custom rule to sort content:

pages-mardown/
├ docs/
   ├ feat-A-doc1.md
   ├ feat-A-doc2.md
   ├ feat-B-doc1.md
   ├ feat-B-doc2.md
   ├ feat-B-doc3.md
``

## how to?

Please take example to the function `include` in the NextMarkdownConfig type, where `include` has a default behavior that can be overridden.
@frouo frouo added the enhancement New feature or request label Mar 24, 2022
@frouo frouo changed the title Allow to customize the YYYY-MM-DD rule for given folder feat: allow to customize the YYYY-MM-DD rule for given folder Apr 4, 2022
@frouo
Copy link
Owner Author

frouo commented Apr 8, 2022

Here are the rules we should go for:

  • rule 1: we keep the prefix _ rule : files starting with _ will be ignored (ie. next-markdown won't create a path for it). It allows to easily publish / unpublish a page
  • rule 2: in a given folder, every files (except index.md) will be listed in the index.md rendered page.
  • rule 3: if any, text within the brackets at the beginning of the file (but after _ see rule 1) will be ignored (eg: file [feat1]hello_world.md will create /hello_world)

Note: having bracket is totally optional (cf. rule 2)

Examples, resulting to the same behavior

brackets
image image

The index.md rendered page will received props:

props: {
  ...
  posts: [
    {
      ...
      nextmd: [docs, get-started]
    },
    {
      ...
      nextmd: [docs, blog-aware]
    },
    {
      ...
      nextmd: [docs, dynamic-routes]
    },
    {
      ...
      nextmd: [docs, table-of-contents]
    },
    {
      ...
      nextmd: [docs, examples]
    },
    {
      ...
      nextmd: [docs, contributing]
    },
  ]

What if I don't want a file to be listed?

Answer: create a folder; cf. rule 2: only files will be listed in the index.md rendered page.

In the following example, /docs/contribution will not be listed in the rendering of /docs

image

@frouo frouo changed the title feat: allow to customize the YYYY-MM-DD rule for given folder feat: enhance blog-aware rules to handle more use cases (blog, docs...) Apr 8, 2022
@frouo frouo closed this as completed in #17 Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant