mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-16 12:14:49 -04:00
Add render-image code example and edit wording
Code example included for making a render-image.html template
This commit is contained in:
parent
bd0a0207c4
commit
f900a2ce0a
@ -125,17 +125,31 @@ Text
|
|||||||
PlainText
|
PlainText
|
||||||
: The plain variant of the above.
|
: The plain variant of the above.
|
||||||
|
|
||||||
A Markdown example for an inline-style link with title:
|
#### Link with title Markdown example :
|
||||||
|
|
||||||
```md
|
```md
|
||||||
[Text](https://www.gohugo.io "Title")
|
[Text](https://www.gohugo.io "Title")
|
||||||
```
|
```
|
||||||
|
|
||||||
A very simple template example given the above:
|
Here is a code example for how the render-link.html template could look:
|
||||||
|
|
||||||
{{< code file="layouts/_default/_markup/render-link.html" >}}
|
{{< code file="layouts/_default/_markup/render-link.html" >}}
|
||||||
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank"{{ end }}>{{ .Text }}</a>
|
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank"{{ end }}>{{ .Text }}</a>
|
||||||
{{< /code >}}
|
{{< /code >}}
|
||||||
|
|
||||||
|
#### Image Markdown example:
|
||||||
|
|
||||||
|
```md
|
||||||
|

|
||||||
|
```
|
||||||
|
|
||||||
|
Here is a code example for how the render-image.html template could look:
|
||||||
|
|
||||||
|
{{< code file="layouts/_default/_markup/render-image.html" >}}
|
||||||
|
<p class="md__image">
|
||||||
|
<img src="{{ .Destination | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}"{{ end }} />
|
||||||
|
</p>
|
||||||
|
{{< /code >}}
|
||||||
|
|
||||||
[^hooktemplate]: It's currently only possible to have one set of render hook templates, e.g. not per `Type` or `Section`. We may consider that in a future version.
|
[^hooktemplate]: It's currently only possible to have one set of render hook templates, e.g. not per `Type` or `Section`. We may consider that in a future version.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user