refactor: Ajout de partials
This commit is contained in:
parent
c878f601db
commit
2357361376
|
@ -1,31 +1,12 @@
|
|||
{{ define "main" }}
|
||||
<div class="info">
|
||||
<a href="/">
|
||||
<h1>{{ .Title }}</h1>
|
||||
</a>
|
||||
{{ .Content }}
|
||||
</div>
|
||||
<div class="portfolio">
|
||||
<ul class="categories">
|
||||
{{- range $name, $items := .Site.Taxonomies.categories }}
|
||||
<li><a href="{{ "categories/" | relLangURL }}{{ $name | urlize | lower }}/#categories">#{{ $name | title | humanize }}</a></li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
<ul class="projets">
|
||||
{{ $pages := (.Site.GetPage "/portfolio").Pages.Reverse }}
|
||||
{{ range $pages }}
|
||||
<li class="item">
|
||||
{{ $image := .Resources.GetMatch (default "*" .Params.image) }}
|
||||
{{ if $image }}
|
||||
{{ $resized := $image.Fill "280x280 Center"}}
|
||||
<img src="{{ $resized.RelPermalink }}">
|
||||
{{ end }}
|
||||
<a href="{{.RelPermalink}}" class="description">
|
||||
<h2>{{ .Title }}</h2>
|
||||
<p>{{ .Description }}</p>
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="info">
|
||||
<a href="/">
|
||||
<h1>{{ .Title }}</h1>
|
||||
</a>
|
||||
{{ .Content }}
|
||||
</div>
|
||||
<div class="portfolio">
|
||||
{{ partial "categories" . }}
|
||||
{{ partial "projects" . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
|
@ -1,31 +1,11 @@
|
|||
{{ define "main" }}
|
||||
<div class="info">
|
||||
|
||||
<div class="info">
|
||||
<a href="/">Accueil</a>
|
||||
<h1>{{ .Title }}</h1>
|
||||
{{ .Content }}
|
||||
</div>
|
||||
<div class="portfolio">
|
||||
<ul class="categories">
|
||||
{{- range $name, $items := .Site.Taxonomies.categories }}
|
||||
<li><a href="{{ "categories/" | relLangURL }}{{ $name | urlize | lower }}/#categories">#{{ $name | title | humanize }}</a></li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
<ul class="projets">
|
||||
{{ $pages := (.Site.GetPage "/portfolio").Pages.Reverse }}
|
||||
{{ range $pages }}
|
||||
<li class="item">
|
||||
{{ $image := .Resources.GetMatch (default "*" .Params.image) }}
|
||||
{{ if $image }}
|
||||
{{ $resized := $image.Fill "280x280 Center"}}
|
||||
<img src="{{ $resized.RelPermalink }}">
|
||||
{{ end }}
|
||||
<a href="{{.RelPermalink}}" class="description">
|
||||
<h2>{{ .Title }}</h2>
|
||||
<p>{{ .Description }}</p>
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
<h1>{{ .Title }}</h1>
|
||||
{{ .Content }}
|
||||
</div>
|
||||
<div class="portfolio">
|
||||
{{ partial "categories" . }}
|
||||
{{ partial "projects" . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<ul class="categories" id="categories">
|
||||
{{ $term := .Data.Term }}
|
||||
{{- range $name, $items := .Site.Taxonomies.categories }}
|
||||
<li>
|
||||
<a {{if eq ($name | title) $term }}class="actif" {{ end }}href="{{ "categories/" | relLangURL }}{{ $name | urlize | lower }}/#categories">
|
||||
#{{ $name | title | humanize }}
|
||||
</a>
|
||||
</li>
|
||||
{{- end }}
|
||||
</ul>
|
|
@ -0,0 +1,20 @@
|
|||
<ul class="projets" id="projets">
|
||||
{{
|
||||
$pages := cond (or .IsHome .IsPage)
|
||||
(.Site.GetPage "/portfolio").Pages.Reverse
|
||||
.Data.Pages.Reverse
|
||||
}}
|
||||
{{ range $pages }}
|
||||
<li class="item">
|
||||
{{ $image := .Resources.GetMatch (default "*" .Params.image) }}
|
||||
{{ if $image }}
|
||||
{{ $resized := $image.Fill "280x280 Center"}}
|
||||
<img src="{{ $resized.RelPermalink }}">
|
||||
{{ end }}
|
||||
<a href="{{.RelPermalink}}" class="description">
|
||||
<h2>{{ .Title }}</h2>
|
||||
<p>{{ .Description }}</p>
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
|
@ -8,31 +8,7 @@
|
|||
{{ end }}
|
||||
</div>
|
||||
<div class="portfolio">
|
||||
<ul class="categories" id="categories">
|
||||
{{ $term := .Data.Term }}
|
||||
{{- range $name, $items := .Site.Taxonomies.categories }}
|
||||
<li>
|
||||
<a {{if eq ($name | title) $term }}class="actif" {{ end }}href="{{ "categories/" | relLangURL }}{{ $name | urlize | lower }}/#categories">
|
||||
#{{ $name | title | humanize }}
|
||||
</a>
|
||||
</li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
<ul class="projets" id="projets">
|
||||
{{ $pages := .Data.Pages.Reverse }}
|
||||
{{ range $pages }}
|
||||
<li class="item">
|
||||
{{ $image := .Resources.GetMatch (default "*" .Params.image) }}
|
||||
{{ if $image }}
|
||||
{{ $resized := $image.Fill "280x280 Center"}}
|
||||
<img src="{{ $resized.RelPermalink }}">
|
||||
{{ end }}
|
||||
<a href="{{.RelPermalink}}" class="description">
|
||||
<h2>{{ .Title }}</h2>
|
||||
<p>{{ .Description }}</p>
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ partial "categories" . }}
|
||||
{{ partial "projects" . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
Loading…
Reference in New Issue