Affiche le domaine des attributions URL
This commit is contained in:
@@ -199,7 +199,8 @@
|
|||||||
<p class="cover-description">{{ . | markdownify }}</p>
|
<p class="cover-description">{{ . | markdownify }}</p>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- with $coverAttribution -}}
|
{{- with $coverAttribution -}}
|
||||||
<p class="cover-attribution"><strong>Attribution:</strong> <span>{{ . | markdownify }}</span></p>
|
{{- $attribution := partial "media/parse-attribution.html" . -}}
|
||||||
|
<p class="cover-attribution"><strong>Attribution:</strong> <span>{{- if index $attribution "isURL" -}}<a href="{{ index $attribution "url" }}" class="link-external" title="Lien externe" rel="noreferrer noopener">{{ index $attribution "label" }}</a>{{- else -}}{{ . | markdownify }}{{- end -}}</span></p>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- with $coverPrompt -}}
|
{{- with $coverPrompt -}}
|
||||||
<details>
|
<details>
|
||||||
|
|||||||
19
themes/2026/layouts/_partials/media/parse-attribution.html
Normal file
19
themes/2026/layouts/_partials/media/parse-attribution.html
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{{- $raw := printf "%v" . -}}
|
||||||
|
{{- $trimmed := strings.TrimSpace $raw -}}
|
||||||
|
{{- $result := dict
|
||||||
|
"isURL" false
|
||||||
|
"label" ""
|
||||||
|
"url" ""
|
||||||
|
-}}
|
||||||
|
{{- if gt (len (findRE `(?i)^https?://[^[:space:]]+$` $trimmed)) 0 -}}
|
||||||
|
{{- $parsedURL := urls.Parse $trimmed -}}
|
||||||
|
{{- $host := replaceRE `:\d+$` "" $parsedURL.Host -}}
|
||||||
|
{{- if ne $host "" -}}
|
||||||
|
{{- $result = dict
|
||||||
|
"isURL" true
|
||||||
|
"label" $host
|
||||||
|
"url" $trimmed
|
||||||
|
-}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- return $result -}}
|
||||||
@@ -90,7 +90,8 @@
|
|||||||
{{- if or $data.attribution $data.prompt -}}
|
{{- if or $data.attribution $data.prompt -}}
|
||||||
<div class="figure-media-meta-extra">
|
<div class="figure-media-meta-extra">
|
||||||
{{- with $data.attribution -}}
|
{{- with $data.attribution -}}
|
||||||
<p class="figure-attribution cover-attribution"><strong>Attribution :</strong> <span>{{ . | markdownify }}</span></p>
|
{{- $attribution := partial "media/parse-attribution.html" . -}}
|
||||||
|
<p class="figure-attribution cover-attribution"><strong>Attribution :</strong> <span>{{- if index $attribution "isURL" -}}<a href="{{ index $attribution "url" }}" class="link-external" title="Lien externe" rel="noreferrer noopener">{{ index $attribution "label" }}</a>{{- else -}}{{ . | markdownify }}{{- end -}}</span></p>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- with $data.prompt -}}
|
{{- with $data.prompt -}}
|
||||||
<details>
|
<details>
|
||||||
|
|||||||
@@ -30,8 +30,9 @@
|
|||||||
{{- end -}}
|
{{- end -}}
|
||||||
</div>
|
</div>
|
||||||
{{- with $attribution -}}
|
{{- with $attribution -}}
|
||||||
|
{{- $figureAttribution := partial "media/parse-attribution.html" . -}}
|
||||||
<div class="figure-media-meta-extra">
|
<div class="figure-media-meta-extra">
|
||||||
<p class="figure-attribution cover-attribution"><strong>Attribution :</strong> <span>{{ . | markdownify }}</span></p>
|
<p class="figure-attribution cover-attribution"><strong>Attribution :</strong> <span>{{- if index $figureAttribution "isURL" -}}<a href="{{ index $figureAttribution "url" }}" class="link-external" title="Lien externe" rel="noreferrer noopener">{{ index $figureAttribution "label" }}</a>{{- else -}}{{ . | markdownify }}{{- end -}}</span></p>
|
||||||
</div>
|
</div>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
</figcaption>
|
</figcaption>
|
||||||
|
|||||||
@@ -13,7 +13,10 @@
|
|||||||
<figcaption>
|
<figcaption>
|
||||||
{{- with $data.title -}}<p><strong>{{ . }}</strong></p>{{- end -}}
|
{{- with $data.title -}}<p><strong>{{ . }}</strong></p>{{- end -}}
|
||||||
{{- with $data.description -}}<p>{{ . | markdownify }}</p>{{- end -}}
|
{{- with $data.description -}}<p>{{ . | markdownify }}</p>{{- end -}}
|
||||||
{{- with $data.attribution -}}<p><strong>Attribution :</strong> <em>{{ . | markdownify }}</em></p>{{- end -}}
|
{{- with $data.attribution -}}
|
||||||
|
{{- $attribution := partial "media/parse-attribution.html" . -}}
|
||||||
|
<p><strong>Attribution :</strong> <em>{{- if index $attribution "isURL" -}}<a href="{{ index $attribution "url" }}" class="link-external" title="Lien externe" rel="noreferrer noopener">{{ index $attribution "label" }}</a>{{- else -}}{{ . | markdownify }}{{- end -}}</em></p>
|
||||||
|
{{- end -}}
|
||||||
</figcaption>
|
</figcaption>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
</figure>
|
</figure>
|
||||||
|
|||||||
@@ -23,7 +23,8 @@
|
|||||||
{{- if or $data.attribution $data.prompt -}}
|
{{- if or $data.attribution $data.prompt -}}
|
||||||
<div class="figure-media-meta-extra">
|
<div class="figure-media-meta-extra">
|
||||||
{{- with $data.attribution -}}
|
{{- with $data.attribution -}}
|
||||||
<p class="figure-attribution cover-attribution"><strong>Attribution :</strong> <span>{{ . | markdownify }}</span></p>
|
{{- $attribution := partial "media/parse-attribution.html" . -}}
|
||||||
|
<p class="figure-attribution cover-attribution"><strong>Attribution :</strong> <span>{{- if index $attribution "isURL" -}}<a href="{{ index $attribution "url" }}" class="link-external" title="Lien externe" rel="noreferrer noopener">{{ index $attribution "label" }}</a>{{- else -}}{{ . | markdownify }}{{- end -}}</span></p>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- with $data.prompt -}}
|
{{- with $data.prompt -}}
|
||||||
<details>
|
<details>
|
||||||
|
|||||||
Reference in New Issue
Block a user