diff --git a/exampleSite/content/home/posts.md b/exampleSite/content/home/posts.md index c0873a7e..12ff6f2b 100644 --- a/exampleSite/content/home/posts.md +++ b/exampleSite/content/home/posts.md @@ -12,6 +12,9 @@ widget = "posts" # Order that this section will appear in. weight = 30 +# Show posts that contain the following tags. Default to any tags. +tags = [] + # Number of posts to list. count = 5 diff --git a/exampleSite/content/post/getting-started.md b/exampleSite/content/post/getting-started.md index 758c6d11..809bbb00 100644 --- a/exampleSite/content/post/getting-started.md +++ b/exampleSite/content/post/getting-started.md @@ -18,6 +18,7 @@ Key features: - Responsive and mobile friendly - Simple and refreshing one page design - Easy to customize + ## Installation @@ -54,7 +55,7 @@ Assuming you created a new website with the example content following the instal The core parameters for the website can be edited in the `config.toml` configuration file: -- Set `baseurl` to your website URL (we recommend [GitHub Pages](https://pages.github.com/) for free hosting) +- Set `baseurl` to your website URL (we recommend [GitHub Pages](https://georgecushen.com/create-your-website-with-hugo/) for free hosting) - Set `title` to your desired website title such as your name - The example Disqus commenting variable should be cleared (e.g. `disqusShortname = ""`) or set to your own [Disqus](https://disqus.com/) shortname to enable commenting - Edit your details under `[params]`; these will be displayed mainly in the homepage *about* and *contact* widgets (if used). To disable a contact field, simply clear the value to `""`. diff --git a/exampleSite/content/post/migrate-from-jekyll.md b/exampleSite/content/post/migrate-from-jekyll.md index 53312046..ffe10cef 100644 --- a/exampleSite/content/post/migrate-from-jekyll.md +++ b/exampleSite/content/post/migrate-from-jekyll.md @@ -1,7 +1,7 @@ +++ date = "2014-03-10T00:00:00" draft = false -tags = [] +tags = ["jekyll"] title = "Migrate from Jekyll to Hugo" summary = """ Learn how to migrate an existing website from Jekyll to Hugo. diff --git a/layouts/partials/post_li.html b/layouts/partials/post_li.html new file mode 100644 index 00000000..98aca7c4 --- /dev/null +++ b/layouts/partials/post_li.html @@ -0,0 +1,29 @@ +{{ $post := .post }} +{{ $page := .page }} + +
+ {{ if $post.Params.image }} + + + + {{end}} +

+ +

+ {{ partial "article_metadata" (dict "content" $post "is_list" 1) }} +

+ {{ if $post.Params.summary }} + {{ printf "%s" $post.Params.summary | markdownify }} + {{ else if $post.Truncated }} + {{ $post.Summary }} + {{ else }} + {{ $post.Content }} + {{ end }} +

+

+ + {{ with $page.Params.str_read_more }}{{ . | markdownify }}{{ end }} + +

+
diff --git a/layouts/partials/widgets/posts.html b/layouts/partials/widgets/posts.html index 24ea1ddc..13a57a0c 100644 --- a/layouts/partials/widgets/posts.html +++ b/layouts/partials/widgets/posts.html @@ -23,37 +23,20 @@
{{ with $page.Content }}

{{ . | markdownify }}

{{ end }} - {{ range first $page.Params.count (where (where $.Data.Pages "Type" "post") ".Params.notonhomepage" nil) }} -
- {{ if .Params.image }} - - - - {{end}} -

- -

- {{ partial "article_metadata" (dict "content" . "is_list" 1) }} -

- {{ if .Params.summary }} - {{ printf "%s" .Params.summary | markdownify }} - {{ else if .Truncated }} - {{ printf "%s" .Summary | markdownify }} - {{ else }} - {{ .Content }} - {{ end }} -

-

- - {{ with $page.Params.str_read_more }}{{ . | markdownify }}{{ end }} - -

-
+ {{ if $page.Params.tags }} + {{ range first $page.Params.count (where (where (where $.Data.Pages "Type" "post") ".Params.tags" "intersect" $page.Params.tags) ".Params.notonhomepage" nil) }} + {{ $params := dict "post" . "page" $page }} + {{ partial "post_li" $params }} + {{ end }} + {{ else }} + {{ range first $page.Params.count (where (where $.Data.Pages "Type" "post") ".Params.notonhomepage" nil) }} + {{ $params := dict "post" . "page" $page }} + {{ partial "post_li" $params }} + {{ end }} {{ end }} +
- {{ end }}