cssとかの調整。

調べる

ローカルにファイルを配置することでテーマをオーバーライドできると書いてあるのだが、 どのように配置するか正確なところがわからん。

試行錯誤したところ、

input にテーマのファイルを直接コピーしたら反映された。

theme フォルダでもよさそうなのだけど、 input しか --watch の対象にならないので、 input に入れてしまうのがよさそう。

input
  + assets
  + _Layout.cshtml

レイアウトの構成

ASP.Net のtemplateエンジン、 Razor で構成されていて拡張子は、 cshtml

ファイル名は、Blog Recipeが規定している。

サイトのルート(index), 各記事(post), 記事一覧(archive, tag), タグ一覧(tags)などがある。単純な例はこれ。

テーマを作ってみる

をクローンして、themes/Blog/BlogTemplate/*input にコピーする。 config.yml も #theme BlogTemplate とする。

共通のレイアウトが _Layout.cshtml 。 その中の、 @RenderBody() にルート(_Index.cshtml), 記事(_PostLayout.cshtml), 記事一覧(_Archive.cshtml, _Tag.cshtml), タグ一覧(_Tags.cshtml)がはめ込まれる様子。

_PostIndex.cshtml は廃止されたので使われない。

unknown: blockquote => {"type":"blockquote","children":[{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"[Breaking Change]","position":{"start":{"line":47,"column":7,"offset":1156},"end":{"line":47,"column":24,"offset":1173}}}],"position":{"start":{"line":47,"column":5,"offset":1154},"end":{"line":47,"column":26,"offset":1175}}},{"type":"text","value":"[Refactoring] Moved Blog recipe theme file ","position":{"start":{"line":47,"column":26,"offset":1175},"end":{"line":47,"column":69,"offset":1218}}},{"type":"inlineCode","value":"/_PostIndex.cshtml","position":{"start":{"line":47,"column":69,"offset":1218},"end":{"line":47,"column":89,"offset":1238}}},{"type":"text","value":" to ","position":{"start":{"line":47,"column":89,"offset":1238},"end":{"line":47,"column":93,"offset":1242}}},{"type":"inlineCode","value":"/_Archive.cshtml","position":{"start":{"line":47,"column":93,"offset":1242},"end":{"line":47,"column":111,"offset":1260}}},{"type":"text","value":", no other changes should be needed to this file in themes other than to move it - sorry for the rename (again), the first name was kind of dumb, this one is better","position":{"start":{"line":47,"column":111,"offset":1260},"end":{"line":47,"column":275,"offset":1424}}}],"position":{"start":{"line":47,"column":5,"offset":1154},"end":{"line":47,"column":275,"offset":1424}}}],"position":{"start":{"line":47,"column":3,"offset":1152},"end":{"line":47,"column":275,"offset":1424}}}],"position":{"start":{"line":47,"column":3,"offset":1152},"end":{"line":47,"column":275,"offset":1424}}}],"position":{"start":{"line":47,"column":1,"offset":1150},"end":{"line":47,"column":275,"offset":1424}}}

日本語が文字化けするので、 _Layout.cshtml<meta charset="UTF-8"> だけ足す。 あとは適当にやってみる。

cshtml からアクセスできる変数

  • Model

  • Context

<a href="@Context.GetLink(Context.String(BlogKeys.PostsPath))">Back To posts</a>

作業メモ

ToDo

動作

複数のパイプラインが登録してあって(Recipe)、ひとつずつ実行する

public IReadOnlyList<IDocument> Execute(ExecutionContext context, IEnumerable<IModule> modules, ImmutableArray<IDocument> inputDocuments

foreach(var pipeline in pipelines)
{
  ExecutionPipeline.Execute
}