-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add size option for article images (#208)
- Loading branch information
1 parent
d79e771
commit 6d989e2
Showing
3 changed files
with
21 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
{{/* Renders images in articles */}} | ||
{{ $hasHash := in .Destination "#" }} | ||
{{ $parts := cond $hasHash (split .Destination "#") (slice .Destination "") }} | ||
{{ $class := cond $hasHash (index $parts 1) "" }} | ||
{{ $imgSrc := index $parts 0 }} | ||
|
||
{{ if .Title }} | ||
<figure> | ||
<img loading="lazy" src="{{.Destination | safeURL}}" alt="{{.Text}}" /> | ||
<img loading="lazy" src="{{ $imgSrc | safeURL }}" alt="{{.Text}}" {{ with $class }}class="{{ . }}"{{ end }} /> | ||
<figcaption>{{ .Title | markdownify }}</figcaption> | ||
</figure> | ||
{{ else }} | ||
<img loading="lazy" src="{{.Destination | safeURL}}" alt="{{.Text}}" /> | ||
<img loading="lazy" src="{{ $imgSrc | safeURL }}" alt="{{.Text}}" {{ with $class }}class="{{ . }}"{{ end }} /> | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6d989e2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
haystack-home – ./
haystack-home.vercel.app
haystack.deepset.ai
haystack-home-git-main-deepset-overnice.vercel.app
haystack-home-deepset-overnice.vercel.app