refactor: Simplify url generation
This commit is contained in:
parent
72409f0c5a
commit
762fd00da2
|
@ -34,13 +34,20 @@
|
|||
<p>{{ $service.description | default $defaultValues.description }}</p>
|
||||
<div class="btn-group" role="group" aria-label="Basic outlined example">
|
||||
<a href="{{ $service.doc | default $defaultValues.doc }}" class="btn btn-outline-primary">Guide</a>
|
||||
{{ $url := "" }}
|
||||
{{ if $service.subdomain }}
|
||||
<a href="https://{{ print $service.subdomain "." site.Params.domain }}/" class="btn btn-primary">Accéder au service</a>
|
||||
{{ $url = print "https://" $service.subdomain "." site.Params.domain "/" }}
|
||||
{{ else if $service.link }}
|
||||
<a href="{{ $service.link }}/" class="btn btn-primary">Accéder au service</a>
|
||||
{{ $url = print $service.link "/" }}
|
||||
{{ else }}
|
||||
<a href="https://{{ print $defaultValues.subdomain "." site.Params.domain }}/" class="btn btn-primary">Accéder au service</a>
|
||||
{{ $url = print "https://" $defaultValues.subdomain "." site.Params.domain "/" }}
|
||||
{{ end }}
|
||||
<a
|
||||
href="{{ $url }}"
|
||||
class="btn btn-primary"
|
||||
>
|
||||
Accéder au service
|
||||
</a>
|
||||
</div>
|
||||
{{ if site.Params.poweredBy }}
|
||||
<p class="text-muted"><small>Propulsé par <a href="{{ $defaultValues.tool.link }}">{{ $defaultValues.tool.name }}</a></small></p>
|
||||
|
|
|
@ -1,19 +1,24 @@
|
|||
<hr class="mt-1 mb-1"/>
|
||||
<ul id="socialMenu" class="nav mx-auto flex-row order-lg-4">
|
||||
{{ range $service := site.Data.services }}
|
||||
{{ $defaultValues := index site.Data.portails.services $service.name }}
|
||||
{{ $icon := $service.icon | default $defaultValues.icon }}
|
||||
{{- range $service := site.Data.services -}}
|
||||
{{- $defaultValues := index site.Data.portails.services $service.name -}}
|
||||
{{- $icon := $service.icon | default $defaultValues.icon -}}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link social-link" title="{{ $service.title | default $defaultValues.title }}" href="{{- if $service.subdomain -}}
|
||||
{{- print "https://" $service.subdomain "." site.Params.domain -}}
|
||||
{{- $url := "" -}}
|
||||
{{- if $service.subdomain -}}
|
||||
{{- $url = print "https://" $service.subdomain "." site.Params.domain "/" -}}
|
||||
{{- else if $service.link -}}
|
||||
{{- $service.link -}}
|
||||
{{- $url = print $service.link "/" -}}
|
||||
{{- else -}}
|
||||
{{- print "https://" $defaultValues.subdomain "." site.Params.domain -}}
|
||||
{{- end -}}">
|
||||
{{- partial "inline-svg" $icon }}
|
||||
{{- $url = print "https://" $defaultValues.subdomain "." site.Params.domain "/" -}}
|
||||
{{- end -}}
|
||||
<a
|
||||
class="nav-link social-link"
|
||||
title="{{ $service.title | default $defaultValues.title }}"
|
||||
href="{{ $url }}"
|
||||
>
|
||||
{{- partial "inline-svg" $icon -}}
|
||||
<small class="ms-2 visually-hidden">{{ $service.title | default $defaultValues.title }}</small>
|
||||
</a>
|
||||
</li>
|
||||
{{ end -}}
|
||||
{{- end -}}
|
||||
</ul>
|
||||
|
|
Loading…
Reference in New Issue