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

请问如何支持 category #88

Open
fofen opened this issue Oct 23, 2017 · 3 comments
Open

请问如何支持 category #88

fofen opened this issue Oct 23, 2017 · 3 comments
Assignees
Labels

Comments

@fofen
Copy link
Contributor

fofen commented Oct 23, 2017

请问如何支持 category?
我们的文库,需要根据 category 构建多级菜单。

先行谢过~

@imeoer
Copy link
Member

imeoer commented Oct 24, 2017

@hiweed 早前为了保持简单,仅支持 tag 分类,目前对 category 支持还不完整。

@imeoer imeoer added the feature label Oct 24, 2017
@imeoer imeoer self-assigned this Oct 24, 2017
@fofen
Copy link
Contributor Author

fofen commented Oct 24, 2017

谢谢回复。
若能支持完整的 category,并能够生产多级导航栏/菜单,那就太好啦。

这的确增加了复杂度,不过很期待。
这两天在看 Jekyll,功能虽多,但太复杂。相比之下,Ink 真是小巧、优雅!

感恩您的付出!

@fofen
Copy link
Contributor Author

fofen commented Nov 8, 2017

@imeoer 我有个想法,您看行不行?
这个 catagory,其实完全可以不用写在 metadata 里,而是用目录、子目录来实现。
同类别的 markdown 文件,放在同一个文件夹里。

source 目录
├── 书籍
│   ├── 宗教
│   │   └── 佛教
│   └── 社会科学
│       └── post01.md
└── 食品
    ├── 坚果
    │   └── post02.md
    ├── 水果
    │   └── post03.md
    └── 粮食
        ├── post04.md
        ├── 细粮
        │   └── post05.md
        └── 粗粮
            └── post06.md

这种组织方式,既简单又优雅,不必为每个文件注明类别;生成的 html 也仍然保持目录结构,一目了然。
比如,post06.md 就会生成 /public/食品/粗粮/post06.html

导航菜单也就可以直接使用这些目录结构了。

大多数 flat-file CMS(比如 grav),都会规定严格的目录结构:
image

这种以目录结构来确定 category 的想法,不知您赞同否?
如果赞同,我想尝试一下,看看能不能做出来。

需要做的有:

  1. 在写 html 文件时,需要写到对应的目录(保持 source 目录的结构);
  2. 遍历所有子目录,取得 dirList;
  3. 用 jQuery 来把 dirList 做成下拉菜单

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants