2020年7月9日木曜日

開発環境

Build Websites With Hugo: Fast Web Development With Markdown (Brian P. Hogan(著)、Pragmatic Bookshelf)のChapter 3(Adding Content Sections)、Your Turn 1.の解答を求めてみる。

portfolio/themes/basic/layouts/index.html

{{ define "main"}}
<h2>最新</h2>
<section class="project">
 {{ $page := index (where .Site.RegularPages "Type" "in" "projects").ByDate.Reverse 0}}
 <h3>{{ $page.Title }}</h3>
 {{ $page.Content }}
</section>
{{ .Content }}
{{ end }}

入出力結果(Zsh、PowerShell、Terminal、Jupyter(IPython))

% tree themes/basic/layouts 
themes/basic/layouts
├── 404.html
├── _default
│   ├── baseof.html
│   ├── list.html
│   └── single.html
├── index.html
├── partials
│   ├── footer.html
│   ├── head.html
│   ├── header.html
│   └── nav.html
└── projects
    └── single.html

3 directories, 10 files
% 

0 コメント:

コメントを投稿