mirror of
https://github.com/falsycat/ar.falsy.cat.git
synced 2024-12-26 00:14:51 +00:00
fix: image scaling for md-style links (closes #155)
This commit is contained in:
parent
d3e20b8b94
commit
eda370334a
@ -66,7 +66,7 @@ Please note that the `cname` field should *not* have any path `e.g. end with /qu
|
|||||||
|
|
||||||
[Reference `deploy.yaml` here](https://github.com/jackyzha0/quartz/blob/hugo/.github/workflows/deploy.yaml)
|
[Reference `deploy.yaml` here](https://github.com/jackyzha0/quartz/blob/hugo/.github/workflows/deploy.yaml)
|
||||||
|
|
||||||
```yaml
|
```yaml {title=".github/workflows/deploy.yaml"}
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
uses: peaceiris/actions-gh-pages@v3
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
with:
|
with:
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
{{$src := .Destination | safeURL }}
|
{{$src := .Destination | safeURL }}
|
||||||
|
{{$width := index (split .Text "|") 1 | default "auto" }}
|
||||||
{{$external := strings.HasPrefix $src "http" }}
|
{{$external := strings.HasPrefix $src "http" }}
|
||||||
{{- if $external -}}
|
{{- if $external -}}
|
||||||
<img src="{{ $src }}" alt="{{ .Text }}" {{ with .Title }} title="{{ . }}" {{ end }} />
|
<img src="{{ $src }}" width="{{ $width }}" alt="{{ .Text }}" {{ with .Title }} title="{{ . }}" {{ end }} />
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{$fixedUrl := (cond (hasPrefix $src "/") $src (print "/" $src)) | urlize}}
|
{{$fixedUrl := (cond (hasPrefix $src "/") $src (print "/" $src)) | urlize}}
|
||||||
<img src="{{.Page.Site.BaseURL}}{{ $fixedUrl }}" alt="{{ .Text }}" {{ with .Title }} title="{{ . }}" {{ end }} />
|
<img src="{{.Page.Site.BaseURL}}{{ $fixedUrl }}" width="{{ $width }}" alt="{{ .Text }}" {{ with .Title }} title="{{ . }}" {{ end }} />
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
Loading…
Reference in New Issue
Block a user