Skip to content

Commit

Permalink
Merge pull request #18 from bul-ikana/page-resources-support
Browse files Browse the repository at this point in the history
Page resources support. Closes #14 .
  • Loading branch information
bul-ikana committed Oct 19, 2020
2 parents ac2ac3b + 22ba471 commit 1837d73
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 8 deletions.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
layout: post
title: "Installation"
img: image-3.png
categories: [one]
categories: ["one", "two"]
tags: ["tag_c"]
date: 2016-05-09
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: post
title: "Post with no image"
category: two
categories: ["one", "two"]
date: 2016-06-09
---
When there is no image mentioned in the front-matter, default image will be displayed. You can change this image to any other one that suits your needs.
Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Usage Guide"
img: image-2.png
categories: [two]
categories: ["one", "two"]
date: "2016-06-12"
---

Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "Welcome to Hugo!"
title: "Welcome to Hugox!"
date: 2016-06-13 10:51:47 +0530
img: "image-1.png"
categories: [one, two]
Expand Down
6 changes: 5 additions & 1 deletion layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
<div class="panel panel-default">

{{ if .Params.img }}
<img width="100%" src="{{ .Site.BaseURL }}images/{{ .Params.img }}" alt="{{ .Title }}">
{{ with .Resources.Match .Params.img }}
{{ range . }}
<img width="100%" src="{{ .RelPermalink }}" alt="{{ .Title }}">
{{ end }}
{{ end }}
{{ else }}
<img width="100%" src="{{ .Site.BaseURL }}images/{{ .Site.Params.defaultImage }}" alt="{{ .Site.Title }}">
{{ end }}
Expand Down
8 changes: 6 additions & 2 deletions layouts/partials/sidebar.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<div class="col-md-4 mt20">
<div class="post-img">
{{ if .Params.img }}
<img width="600" src="{{ .Site.BaseURL}}images/{{ .Params.img }}" alt="{{ .Params.title }}">
{{ if .Params.img }}
{{ with .Resources.Match .Params.img }}
{{ range . }}
<img width="100%" src="{{ .RelPermalink }}" alt="{{ .Title }}">
{{ end }}
{{ end }}
{{ else }}
<img width="600" src="{{ .Site.BaseURL }}images/{{ .Site.Params.defaultImage }}" alt="webjeda">
{{ end }}
Expand Down
6 changes: 5 additions & 1 deletion layouts/taxonomy/tag.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
<div class="panel panel-default">

{{ if .Params.img }}
<img width="100%" src="{{ .Site.BaseURL }}images/{{ .Params.img }}" alt="{{ .Title }}">
{{ with .Resources.Match .Params.img }}
{{ range . }}
<img width="100%" src="{{ .RelPermalink }}" alt="{{ .Title }}">
{{ end }}
{{ end }}
{{ else }}
<img width="100%" src="{{ .Site.BaseURL }}images/{{ .Site.Params.defaultImage }}" alt="{{ .Site.Title }}">
{{ end }}
Expand Down

0 comments on commit 1837d73

Please sign in to comment.