diff --git a/assets/images/pages/glossary/glossary-banner.svg b/assets/images/pages/glossary/glossary-banner.svg new file mode 100644 index 00000000..3d514cc0 --- /dev/null +++ b/assets/images/pages/glossary/glossary-banner.svg @@ -0,0 +1 @@ + diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml index 808d615d..3d47229c 100644 --- a/config/packages/twig.yaml +++ b/config/packages/twig.yaml @@ -24,7 +24,7 @@ twig: trackers: matomo: "%env(MATOMO_ID)%" - + caseStudies: enabled: true @@ -45,6 +45,7 @@ twig: footer: - { path: "case_studies", label: "Cas clients" } - { path: "about", label: "À propos" } + - { path: "glossary", label: "Glossaire" } - { path: "contact", label: "Contact" } footerServices: diff --git a/content/member/_sample.yaml b/content/member/_sample.yaml index 31dab47f..2684f689 100644 --- a/content/member/_sample.yaml +++ b/content/member/_sample.yaml @@ -20,10 +20,6 @@ linkedIn: ~ email: ~ avatar: content/images/member/avatars/path-to-avatar.jpg -certifications: - - symfony - - opquast - emojis: - 🎲 - 🎮 diff --git a/content/member/frey.yaml b/content/member/frey.yaml index 2717cca3..64bb985e 100644 --- a/content/member/frey.yaml +++ b/content/member/frey.yaml @@ -17,8 +17,6 @@ linkedIn: ~ email: florian.rey@elao.com avatar: content/images/member/avatars/ffrey.jpg -certifications: [ ] - emojis: - 🌰 - 👾 diff --git a/content/member/gfaivre.yaml b/content/member/gfaivre.yaml index 2af72b72..8ee082d9 100644 --- a/content/member/gfaivre.yaml +++ b/content/member/gfaivre.yaml @@ -14,8 +14,6 @@ avatar: content/images/member/avatars/gfaivre.jpg phone: '007' -certifications: [ ] - emojis: - 🤾🏻♂️ - 🎮 diff --git a/content/member/yheitz.yaml b/content/member/yheitz.yaml index c2cd88ab..19d18d75 100644 --- a/content/member/yheitz.yaml +++ b/content/member/yheitz.yaml @@ -13,6 +13,4 @@ linkedIn: ~ email: yves.heitz@elao.com avatar: content/images/member/avatars/yheizt.png -certifications: [ ] - emojis: [ ] diff --git a/content/term/aws.md b/content/term/aws.md new file mode 100644 index 00000000..4a2010a0 --- /dev/null +++ b/content/term/aws.md @@ -0,0 +1,8 @@ +--- +name: "AWS" +logo: "build/images/services/aws.svg" +externalLink: https://aws.amazon.com/fr/ +#metaDescription: TODO +--- + +Some **markdown** content diff --git a/content/term/aws.yaml b/content/term/aws.yaml deleted file mode 100644 index 19474b6d..00000000 --- a/content/term/aws.yaml +++ /dev/null @@ -1,3 +0,0 @@ -name: "AWS" -logo: "build/images/services/aws.svg" -link: https://aws.amazon.com/fr/ diff --git a/content/term/example.md b/content/term/example.md new file mode 100644 index 00000000..a3469a6c --- /dev/null +++ b/content/term/example.md @@ -0,0 +1,17 @@ +--- +name: "Exemple" +logo: "build/images/technos/exemple.svg" +externalLink: http://example.org + +# False to prevent listing it on the glossary page. +# Cans till be externalLinked from articles or case studies. +listInGlossary: false + +# Array of slugs of related articles to show on the glossary term page. +# If not provided (null), will search for related articles by their tags. +articles: [] + +metaDescription: Une description courte à utiliser dans les meta de la page +--- + +Some **markdown** content diff --git a/content/term/example.yaml b/content/term/example.yaml deleted file mode 100644 index 17f798a4..00000000 --- a/content/term/example.yaml +++ /dev/null @@ -1,3 +0,0 @@ -name: "Exemple" -logo: "build/images/technos/exemple.svg" -link: http://example.org diff --git a/content/term/ovh-cloud.md b/content/term/ovh-cloud.md new file mode 100644 index 00000000..520c35ce --- /dev/null +++ b/content/term/ovh-cloud.md @@ -0,0 +1,8 @@ +--- +name: "OVH Cloud" +logo: "build/images/services/ovh-cloud.svg" +externalLink: https://www.ovhcloud.com/fr/ +#metaDescription: TODO +--- + +Some **markdown** content diff --git a/content/term/ovh-cloud.yaml b/content/term/ovh-cloud.yaml deleted file mode 100644 index e824d23b..00000000 --- a/content/term/ovh-cloud.yaml +++ /dev/null @@ -1,3 +0,0 @@ -name: "OVH Cloud" -logo: "build/images/services/ovh-cloud.svg" -link: https://www.ovhcloud.com/fr/ diff --git a/content/term/scaleway.md b/content/term/scaleway.md new file mode 100644 index 00000000..1179ed93 --- /dev/null +++ b/content/term/scaleway.md @@ -0,0 +1,8 @@ +--- +name: "Scaleway" +logo: "build/images/services/scaleway.svg" +externalLink: https://www.scaleway.com/fr/ +#metaDescription: TODO +--- + +Some **markdown** content diff --git a/content/term/scaleway.yaml b/content/term/scaleway.yaml deleted file mode 100644 index 19e7b3eb..00000000 --- a/content/term/scaleway.yaml +++ /dev/null @@ -1,3 +0,0 @@ -name: "Scaleway" -logo: "build/images/services/scaleway.svg" -link: https://www.scaleway.com/fr/ diff --git a/src/Controller/GlossaryController.php b/src/Controller/GlossaryController.php new file mode 100644 index 00000000..7028bc20 --- /dev/null +++ b/src/Controller/GlossaryController.php @@ -0,0 +1,62 @@ +manager = $manager; + } + + #[Route('/', name: 'glossary')] + public function glossary(GlossaryBuilder $builder): Response + { + $terms = $this->manager->getContents(Term::class, 'name', ['listInGlossary' => true]); + $articles = $this->manager->getContents(Article::class, ['date' => false]); + + return $this->render('glossary/index.html.twig', [ + 'glossary' => $builder->build($terms), + 'articles' => \array_slice($articles, 0, 4), + ]); + } + + #[Route('/{term}', name: 'glossary_term')] + public function show(Term $term): Response + { + $articlesFilter = null !== $term->articles + // Search for articles by their slug if provided + ? static fn ($article) => \in_array($article->slug, $term->articles, true) + // otherwise by their tags matching the term slug + : static fn (Article $article): bool => $article->hasTag($term->slug) + ; + + $articles = $this->manager->getContents(Article::class, ['date' => false], $articlesFilter); + + $caseStudies = $this->manager->getContents( + CaseStudy::class, + ['date' => false], + fn (CaseStudy $caseStudy): bool => $caseStudy->enabled && $caseStudy->hasTerm($term) + ); + + return $this->render('glossary/term.html.twig', [ + 'term' => $term, + 'articles' => \array_slice($articles, 0, 3), + 'caseStudies' => $caseStudies, + ])->setLastModified($term->lastModified); + } +} diff --git a/src/Glossary/GlossaryBuilder.php b/src/Glossary/GlossaryBuilder.php index f44b997f..6e193059 100644 --- a/src/Glossary/GlossaryBuilder.php +++ b/src/Glossary/GlossaryBuilder.php @@ -9,8 +9,8 @@ class GlossaryBuilder { /** - * @param array|Term[] $terms - * @param int<0, max> $split + * @param Term[] $terms + * @param int<0, max> $split */ public function build(array $terms, int $split = 3): array { diff --git a/src/Model/Glossary/Term.php b/src/Model/Glossary/Term.php index 6b1eafca..43e93983 100644 --- a/src/Model/Glossary/Term.php +++ b/src/Model/Glossary/Term.php @@ -4,11 +4,37 @@ namespace App\Model\Glossary; +use App\Model\MetaTrait; + class Term { - public string $name; - public ?string $logo = null; + use MetaTrait; + public string $slug; - public string $link; + + public ?string $logo = null; + + /** Link to outside resource for this term. */ + public string $externalLink; + + public string $name; + + /** Main, markdown content */ + public ?string $content = null; + + /** + * Array of slugs of related articles to show on the glossary term page. + * If not provided (null), will search for related articles by their tags. + * + * @var string[]|null + */ + public ?array $articles = null; + public \DateTimeInterface $lastModified; + + /** + * Set as false to prevent this term to appear in glossary listing. + * The term can still be referenced from articles or case studies. + */ + public bool $listInGlossary = true; } diff --git a/src/Model/Member.php b/src/Model/Member.php index 142ec773..7f1bde52 100644 --- a/src/Model/Member.php +++ b/src/Model/Member.php @@ -34,9 +34,6 @@ class Member public ?string $phone = null; - /** @var string[] */ - public array $certifications = []; - public ?array $emojis = []; // Flags diff --git a/templates/case_study/show.html.twig b/templates/case_study/show.html.twig index df8ef417..5cf88b94 100644 --- a/templates/case_study/show.html.twig +++ b/templates/case_study/show.html.twig @@ -1,12 +1,13 @@ {% import "macros.html.twig" as macros %} + {% extends 'base.html.twig' %} {% block meta_title -%} - {{ caseStudy.metaTitle|default(caseStudy.title) }} | {{ parent() }} + {{ caseStudy.metaTitle ?? caseStudy.title }} | {{ parent() }} {%- endblock %} {% block meta_description -%} - {{ caseStudy.metaDescription|default(caseStudy.description)|default(parent()) }} + {{ caseStudy.metaDescription ?? parent() }} {%- endblock %} {% block og_image asset(caseStudy.images|first|glide_image_preset('opengraph_image')) %} @@ -42,7 +43,7 @@
{{ article.description }}
+