2

我正在研究 Wintersmith 化我的网站,该网站目前是手写的。我有几个页面:、、、index.htmlprojects.htmlgpg.html我想要一个blog/子目录,以便最终站点如下所示:

.
|- index.html
|- gpg.html
|- project.html
|- blog/
|  |- look-a-new-wintersmith-blog.md
|  |- monkeys-are-really-cool.md

这可能吗?我搜索并查看了 Wintersmith 文档(甚至是由 Wintersmith 提供支持的特色站点),但一无所获。似乎唯一的方法是拥有两个 Wintersmith 或其他东西的实例,但似乎必须有更好的方法。

4

1 回答 1

2

您应该通过以下方式获得所需的结果:

├── config.json               <- site configuration
├── contents
│   ├── index.html            <- these will just be outputted as-is
│   ├── gpg.html
│   ├── project.html
│   ├── blog                  <– each article has its own directory
│   │   ├── index.json        <- this is your blog index at /blog/index.html
│   │   ├── look-a-new-wintersmith-blog
│   │   │   └── index.md
│   │   └── monkeys-are-really-cool
│   │       └── index.md
│   ├── authors               <- author metadata, check author.jade
│   │   └── the-wintersmith.json
│   ├── css
│   │   └── main.css
│   └── feed.json
├── plugins
│   └── paginator.coffee      <- paginator plugin
├── templates
│   ├── archive.jade
│   ├── article.jade
│   ├── author.jade
│   ├── feed.jade
│   ├── index.jade
│   └── layout.jade
└── views
    └── articles.coffee       <- view that lists articles

index.json只是重命名并移动archive.json以提供/blog/index.htmlURL。如果您想要默认 Wintersmith 索引而不是存档布局,请编辑文件以使用index.jade布局而不是archive.jade.

如果您将当前的 HTML 文件更改为 Markdown 并将它们放在同一个位置,那么它们将像您的博客文章一样以 HTML 格式输出。

article您可能还想在布局中添加某种导航菜单。

编辑:要创建静态页面,请创建contents类似于以下内容的 Markdown 文件:

---
title: GPG
author: baker
date: 2014-03-23
template: article.jade
---

Content

如果你命名了这个文件gpg.md,它应该可以在http://localhost:8080/gpg.html. 因为我们使用了article.jade模板,所以它需要一个author和一个date完整的字段(它可以在没有作者的情况下工作,但它仍然会包含“作者”而没有作者),但是您可以制作一个不使用这些字段的自定义模板。

于 2014-09-28T14:20:10.703 回答