Update Cake.Wyam to Cake 3.0 by pascalberger · Pull Request #29 · Wyamio/Wyam
Update Cake.Wyam to reference Cake 3.0 and target net6.0 and net7.0.
Update Cake.Wyam to Cake 3.0 by pascalberger · Pull Request #29 · Wyamio/Wyam favicon https://github.com/Wyamio/Wyam/issues/29
Update Cake.Wyam to Cake 3.0 by pascalberger · Pull Request #29 · Wyamio/Wyam

調べる

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

試行錯誤したところ、

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 は廃止されたので使われない。

  • [Breaking Change][Refactoring] Moved Blog recipe theme file /_PostIndex.cshtml to /_Archive.cshtml, 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

日本語が文字化けするので、 _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
}