feat: Ajout des liens entre les évènements et les associations
This commit is contained in:
parent
16c0de360f
commit
89843f2353
|
@ -24,7 +24,14 @@
|
||||||
<h1>{{ .RenderString .Title }}</h1>
|
<h1>{{ .RenderString .Title }}</h1>
|
||||||
<div class="container news md">
|
<div class="container news md">
|
||||||
<small>
|
<small>
|
||||||
Publié le <time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Day }} {{ index $.Site.Data.mois (printf "%d" .Date.Month) }} {{ .Date.Year }}</time>{{ if isset .Params "auteur" }} - {{ .Params.auteur }}{{ end }}
|
Publié le <time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Day }} {{ index $.Site.Data.mois (printf "%d" .Date.Month) }} {{ .Date.Year }}</time>{{ if or (isset .Params "auteur") (isset .Params "authors") }} - {{ if isset .Params "authors" -}}
|
||||||
|
{{ range $key, $value := .Params.authors }}
|
||||||
|
{{ with site.GetPage $value }}
|
||||||
|
{{ if gt $key 0 }} & {{ end }}
|
||||||
|
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{- end }}{{ if isset .Params "auteur" }}{{ if isset .Params "authors" -}} & {{ end }}{{ .Params.auteur }}{{ end }}{{ end }}
|
||||||
</small>
|
</small>
|
||||||
{{ .Content }}
|
{{ .Content }}
|
||||||
<aside>
|
<aside>
|
||||||
|
|
|
@ -44,5 +44,21 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ if isset .Params "actualites" }}
|
||||||
|
<div class="container md">
|
||||||
|
<aside>
|
||||||
|
<hr>
|
||||||
|
<h2>
|
||||||
|
Les évènements de l'association
|
||||||
|
</h2>
|
||||||
|
{{ range .Params.actualites }}
|
||||||
|
{{ with site.GetPage . }}
|
||||||
|
{{ .Scratch.Set "big" false }}
|
||||||
|
{{ partial "article-preview.html" . }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</aside>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -16,7 +16,14 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="details">
|
<div class="details">
|
||||||
<small>
|
<small>
|
||||||
<time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Day }} {{ index $.Site.Data.mois (printf "%d" .Date.Month) }} {{ .Date.Year }}</time>{{ if isset .Params "auteur" }} - {{ .Params.auteur }}{{ end }}
|
<time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Day }} {{ index $.Site.Data.mois (printf "%d" .Date.Month) }} {{ .Date.Year }}</time>{{ if or (isset .Params "auteur") (isset .Params "authors") }} - {{ if isset .Params "authors" -}}
|
||||||
|
{{ range $key, $value := .Params.authors }}
|
||||||
|
{{ with site.GetPage $value }}
|
||||||
|
{{ if gt $key 0 }} & {{ end }}
|
||||||
|
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{- end }}{{ if isset .Params "auteur" }}{{ if isset .Params "authors" -}} & {{ end }}{{ .Params.auteur }}{{ end }}{{ end }}
|
||||||
</small>
|
</small>
|
||||||
{{ if $isBig }}
|
{{ if $isBig }}
|
||||||
<h2 title="{{ $titleWithoutHTML }}"><a href="{{ .RelPermalink }}">{{ $title }}</a></h2>
|
<h2 title="{{ $titleWithoutHTML }}"><a href="{{ .RelPermalink }}">{{ $title }}</a></h2>
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
import DirectusToMarkdown from '@resilien/directus-to-markdown'
|
import DirectusToMarkdown from '@resilien/directus-to-markdown'
|
||||||
import urlslug from 'url-slug'
|
import urlslug from 'url-slug'
|
||||||
|
|
||||||
const filterDraft = process.env.DRAFT && process.env.DRAFT == 'true' ? '' : { draft: { _eq: 'false' } }
|
var lastDate = new Date();
|
||||||
|
lastDate.setMonth(lastDate.getMonth() - 3);
|
||||||
|
lastDate.setFullYear(lastDate.getFullYear() - 10);
|
||||||
|
console.log(lastDate)
|
||||||
|
|
||||||
|
const filterDraft = process.env.DRAFT && process.env.DRAFT == 'true' ? { date: { _gt: lastDate } } : { draft: { _eq: 'false' }, date: { _gt: lastDate } }
|
||||||
const filterAssociation = process.env.DRAFT && process.env.DRAFT == 'true' ? '' : { display_website: { _eq: 'true' } }
|
const filterAssociation = process.env.DRAFT && process.env.DRAFT == 'true' ? '' : { display_website: { _eq: 'true' } }
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
|
@ -38,8 +43,8 @@ const config = {
|
||||||
},
|
},
|
||||||
actualites: {
|
actualites: {
|
||||||
readByQueryOption: {
|
readByQueryOption: {
|
||||||
fields: ['title', 'date', 'image', 'image_credit', 'vignette', 'vignette_credit', 'description', 'auteur', 'draft', 'content', 'event'],
|
fields: ['title', 'date', 'image', 'image_credit', 'vignette', 'vignette_credit', 'description', 'auteur', 'draft', 'content', 'event', 'authors.Association_id.denomination'],
|
||||||
filterDraft,
|
filter: filterDraft,
|
||||||
limit: 1000
|
limit: 1000
|
||||||
},
|
},
|
||||||
pathBuilder: (article) => {
|
pathBuilder: (article) => {
|
||||||
|
@ -47,7 +52,16 @@ const config = {
|
||||||
if (!article.image_credit) delete article.image_credit
|
if (!article.image_credit) delete article.image_credit
|
||||||
if (!article.vignette) delete article.vignette
|
if (!article.vignette) delete article.vignette
|
||||||
if (!article.vignette_credit) delete article.vignette_credit
|
if (!article.vignette_credit) delete article.vignette_credit
|
||||||
|
|
||||||
|
if (!article.authors || article.authors.length == 0) {
|
||||||
|
delete article.authors
|
||||||
|
} else {
|
||||||
|
article.authors = article.authors.map(a => `/associations/${urlslug(a.Association_id.denomination)}`)
|
||||||
|
}
|
||||||
const [year, month, day] = article.date.split("-")
|
const [year, month, day] = article.date.split("-")
|
||||||
|
|
||||||
|
console.log(article.date + ' - ' + article.title)
|
||||||
|
|
||||||
return `./content/actualites/${year}/${month}/${day}-${urlslug(article.title, { remove: /\./g })}`;
|
return `./content/actualites/${year}/${month}/${day}-${urlslug(article.title, { remove: /\./g })}`;
|
||||||
},
|
},
|
||||||
deleteFields: [],
|
deleteFields: [],
|
||||||
|
@ -65,8 +79,10 @@ const config = {
|
||||||
'bureau.sort',
|
'bureau.sort',
|
||||||
'bureau.Contact_id.*',
|
'bureau.Contact_id.*',
|
||||||
'content',
|
'content',
|
||||||
|
'actualites.actualites_id.date',
|
||||||
|
'actualites.actualites_id.title',
|
||||||
],
|
],
|
||||||
filterAssociation
|
filter: filterAssociation
|
||||||
},
|
},
|
||||||
pathBuilder: (association) => {
|
pathBuilder: (association) => {
|
||||||
if (!association.title) {
|
if (!association.title) {
|
||||||
|
@ -99,6 +115,16 @@ const config = {
|
||||||
delete association.bureau
|
delete association.bureau
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!association.actualites || association.actualites.length == 0) {
|
||||||
|
delete association.actualites
|
||||||
|
} else {
|
||||||
|
association.actualites = association.actualites.map(a => {
|
||||||
|
const [year, month, day] = a.actualites_id.date.split("-")
|
||||||
|
|
||||||
|
return `/actualites/${year}/${month}/${day}-${urlslug(a.actualites_id.title, { remove: /\./g })}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return `./content/associations/${urlslug(association.denomination)}`;
|
return `./content/associations/${urlslug(association.denomination)}`;
|
||||||
},
|
},
|
||||||
deleteFields: [],
|
deleteFields: [],
|
||||||
|
|
Loading…
Reference in New Issue