From 88018706e13dfe611424a70520105805c965bc92 Mon Sep 17 00:00:00 2001 From: alexisben <alexiben7@gmail.com> Date: Wed, 27 Jul 2022 17:38:49 +0200 Subject: [PATCH] html update --- assets/sass/_theme/_configuration.sass | 8 +- assets/sass/_theme/_utils.sass | 35 +++++---- assets/sass/_theme/blocks/testimonials.sass | 9 ++- .../design-system/table_of_content.sass | 1 + .../sass/_theme/design-system/typography.sass | 8 +- assets/sass/_theme/sections/programs.sass | 22 +++--- layouts/diplomas/term.html | 1 + layouts/pages/list.html | 2 - layouts/partials/GetPageByUrl | 10 +-- layouts/partials/head/css.html | 4 +- layouts/partials/header/breadcrumbs.html | 75 ++++++++++++++----- layouts/partials/pages/aside.html | 2 +- layouts/partials/persons/person.html | 4 +- layouts/partials/programs/admission.html | 59 ++++++++++++--- layouts/partials/programs/aside.html | 7 +- layouts/partials/programs/essential.html | 22 ++++++ layouts/partials/programs/hero-single.html | 26 +++++++ layouts/partials/programs/pedagogy.html | 15 ++-- layouts/partials/programs/presentation.html | 47 ++++++++++-- layouts/partials/programs/results.html | 6 +- layouts/partials/programs/show.html | 65 ++++++---------- layouts/partials/programs/toc.html | 38 ++++------ layouts/persons/single.html | 7 +- layouts/programs/list.html | 6 +- 24 files changed, 313 insertions(+), 166 deletions(-) create mode 100644 layouts/partials/programs/essential.html create mode 100644 layouts/partials/programs/hero-single.html diff --git a/assets/sass/_theme/_configuration.sass b/assets/sass/_theme/_configuration.sass index 1212db01..cb59a4aa 100644 --- a/assets/sass/_theme/_configuration.sass +++ b/assets/sass/_theme/_configuration.sass @@ -59,13 +59,14 @@ $spacing4: 128px !default $spacing5: 256px !default // Grid -$grid-gutter: 60px +$grid-gutter: $spacing3 !default $grid-max-width: 1980px -$grid-gutter-sm: 20px +$grid-gutter-sm: $spacing1 !default // Z-index $zindex-nav-accessibility: 1010 !default $zindex-stretched-link: 2 !default +$zindex-toc: 50 !default // Header $header-color: $main-color !default @@ -164,6 +165,9 @@ $toc-active-color: $main-color !default // TODO : checker ce que ça fait // Person $persons-avatar-background-color: $main-light-color !default +// Program +$program-zindex-toc: $zindex-toc !default + // MISC // Animations diff --git a/assets/sass/_theme/_utils.sass b/assets/sass/_theme/_utils.sass index 20477c5b..4d5ca1cd 100644 --- a/assets/sass/_theme/_utils.sass +++ b/assets/sass/_theme/_utils.sass @@ -99,23 +99,26 @@ top: 0 z-index: $zindex-stretched-link -@mixin aspect-ratio($width, $height, $selector: 'iframe') - #{$selector} - aspect-ratio: #{$width}/#{$height} - display: block - width: 100% - @supports not (aspect-ratio: 1) - position: relative - &::before - content: '' - padding-top: ($height / $width) * 100% - width: 100% +@mixin aspect-ratio($width, $height, $selector: null) + @if $selector #{$selector} - bottom: 0 - left: 0 - position: absolute - right: 0 - top: 0 + aspect-ratio: #{$width}/#{$height} + display: block + width: 100% + @supports not (aspect-ratio: 1) + position: relative + &::before + content: '' + padding-top: ($height / $width) * 100% + width: 100% + #{$selector} + bottom: 0 + left: 0 + position: absolute + right: 0 + top: 0 + @else + aspect-ratio: #{$width}/#{$height} @mixin visually-hidden clip: rect(0,0,0,0) !important diff --git a/assets/sass/_theme/blocks/testimonials.sass b/assets/sass/_theme/blocks/testimonials.sass index f9b7c232..bf59ea5a 100644 --- a/assets/sass/_theme/blocks/testimonials.sass +++ b/assets/sass/_theme/blocks/testimonials.sass @@ -90,10 +90,11 @@ background-color: $block-testimonials-pagination-progress-background width: 0 - @include in-page-without-aside - .testimonials - @include media-breakpoint-up(md) - padding-right: col(4) + body:not(.programs__section) + @include in-page-without-aside + .testimonials + @include media-breakpoint-up(md) + padding-right: col(4) // TODO : en discuter en créa // figure diff --git a/assets/sass/_theme/design-system/table_of_content.sass b/assets/sass/_theme/design-system/table_of_content.sass index 55a7cc47..87cb5a13 100644 --- a/assets/sass/_theme/design-system/table_of_content.sass +++ b/assets/sass/_theme/design-system/table_of_content.sass @@ -15,6 +15,7 @@ line-height: px2rem(30) padding: $spacing1/2 margin-left: -$spacing1/2 + margin-right: -$spacing1/2 text-decoration: none &:hover text-decoration: underline diff --git a/assets/sass/_theme/design-system/typography.sass b/assets/sass/_theme/design-system/typography.sass index 8462bb1f..9191969c 100644 --- a/assets/sass/_theme/design-system/typography.sass +++ b/assets/sass/_theme/design-system/typography.sass @@ -5,26 +5,32 @@ h1, .h1 @extend %heading font-size: $h1-size + font-weight: $h1-weight -h2, .h2 +h2, .h2, .lead @extend %heading font-size: $h2-size + font-weight: $h2-weight h3, .h3 @extend %heading font-size: $h3-size + font-weight: $h3-weight h4, .h4 @extend %heading font-size: $h4-size + font-weight: $h4-weight h5, .h5 @extend %heading font-size: $h5-size + font-weight: $h5-weight h6, .h6 @extend %heading font-size: $h6-size + font-weight: $h6-weight h1, .h1, h2, .h2 diff --git a/assets/sass/_theme/sections/programs.sass b/assets/sass/_theme/sections/programs.sass index eebfc3fc..d05453f7 100644 --- a/assets/sass/_theme/sections/programs.sass +++ b/assets/sass/_theme/sections/programs.sass @@ -47,18 +47,21 @@ // @include grid(2, lg) .programs__section + .lead + padding-top: $spacing4 aside @include container @include sticky($header-height) overflow: auto background: darken($main-background-color, 3) - z-index: 50 + z-index: $program-zindex-toc .toc max-width: 100% ol display: flex flex-direction: row flex-wrap: nowrap + justify-content: space-between white-space: nowrap margin: 0 #{-$spacing1} li @@ -67,17 +70,18 @@ .blocks .block-content padding-left: col(5) - [itemprop="articleBody"] - section - padding-top: $spacing1 - padding-bottom: $spacing4 - border-top: 1px solid $main-color - @include grid(12, md) - @include media-breakpoint-up(md) + + @include media-breakpoint-up(md) + article + .content + @include grid(12, md) + padding-top: $spacing1 + padding-bottom: $spacing4 + border-top: 1px solid $main-color position: relative > * grid-column: 6/13 - h2 + > h2 $sticky-top-offset: 90px @include sticky(#{$header-height + $sticky-top-offset}) top: $sticky-top-offset diff --git a/layouts/diplomas/term.html b/layouts/diplomas/term.html index dba9e935..46ca90d8 100644 --- a/layouts/diplomas/term.html +++ b/layouts/diplomas/term.html @@ -1,6 +1,7 @@ {{ define "main" }} {{ partial "diplomas/hero-single.html" . }} + {{ partial "blocks/list.html" .Params.blocks }} <div class="container"> {{ partial "programs/programs.html" .Pages }} </div> diff --git a/layouts/pages/list.html b/layouts/pages/list.html index 9d4dbb6c..f9824ccb 100644 --- a/layouts/pages/list.html +++ b/layouts/pages/list.html @@ -11,14 +11,12 @@ {{ end }} <div class="content-blocks"> - {{- if $need_aside }} {{ partial "pages/aside.html" (dict "category" $category "context" . ) }} - {{ end -}} {{ partial "blocks/list.html" .Params.blocks }} </div> {{ else }} diff --git a/layouts/partials/GetPageByUrl b/layouts/partials/GetPageByUrl index ca73cb2c..71332313 100644 --- a/layouts/partials/GetPageByUrl +++ b/layouts/partials/GetPageByUrl @@ -1,9 +1,5 @@ -{{ $target := . }} {{ $page := "" }} -{{ range site.Pages }} - {{ $pageTarget := .RelPermalink }} - {{ if eq $pageTarget $target }} - {{ $page = . }} - {{ end }} +{{ range (where site.Pages "RelPermalink" "eq" .) }} + {{ $page = . }} {{ end }} -{{ return $page }} +{{ return $page }} \ No newline at end of file diff --git a/layouts/partials/head/css.html b/layouts/partials/head/css.html index 57691d6f..bd676627 100644 --- a/layouts/partials/head/css.html +++ b/layouts/partials/head/css.html @@ -7,6 +7,6 @@ {{- $styles := resources.Get "sass/main.sass" | toCSS $cssOpts -}} {{ if hugo.IsProduction }} -{{- $styles = resources.Get "sass/main.sass" | toCSS $cssOpts | postCSS | minify | fingerprint -}} + {{- $styles = resources.Get "sass/main.sass" | toCSS $cssOpts | postCSS | minify | fingerprint -}} {{ end }} -<link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}" media="screen"> +<link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}" media="screen"> \ No newline at end of file diff --git a/layouts/partials/header/breadcrumbs.html b/layouts/partials/header/breadcrumbs.html index 3cb3e3f2..f9c7b194 100644 --- a/layouts/partials/header/breadcrumbs.html +++ b/layouts/partials/header/breadcrumbs.html @@ -1,25 +1,64 @@ <nav aria-label="{{ i18n "commons.breadcrumb" }}"> - <ol class="breadcrumb" itemscope itemtype="https://schema.org/BreadcrumbList"> - {{ template "breadcrumbnav" (dict "p1" . "p2" .) }} + {{- $path := strings.TrimSuffix "/" .RelPermalink -}} + {{- $length := len (split $path "/") }} + <ol itemscope itemtype="https://schema.org/BreadcrumbList" class="breadcrumb"> + {{- template "breadcrumbOptimized" + (dict + "p1" . + "p2" . + "path" $path + "position" $length + ) }} </ol> </nav> -{{ define "breadcrumbnav" }} + +{{- define "breadcrumbOptimized" -}} + {{- $positionNext := sub .position 1 -}} {{- if .p1.Parent -}} - {{- template "breadcrumbnav" (dict "p1" .p1.Parent "p2" .p2 ) -}} - {{- else if not .p1.IsHome }} - {{- template "breadcrumbnav" (dict "p1" .p1.Site.Home "p2" .p2 ) -}} + {{- $path := strings.TrimSuffix "/" .path -}} + {{- $split := path.Split $path -}} + {{/* + {{ .p1.Parent.RelPermalink }} <br> {{ $split.Dir }} <br> + */}} + {{- if eq .p1.Parent.RelPermalink $split.Dir -}} + {{/* Normal case, parent matches permalink<br><br> */}} + {{- template "breadcrumbOptimized" (dict "p1" .p1.Parent "p2" .p2 "path" $split.Dir "position" $positionNext) -}} + {{- else -}} + {{/* Dissonant case, the supposed parent does not have the correct path, so we do an expensive search<br><br> */}} + {{- $page := partial "GetPageByUrl" $split.Dir -}} + {{- if $page -}} + {{- template "breadcrumbOptimized" (dict "p1" $page "p2" .p2 "path" $split.Dir "position" $positionNext) -}} + {{- else -}} + {{- template "breadcrumbOptimized" (dict "p1" .p1.Parent "p2" .p2 "path" $split.Dir "position" $positionNext) -}} + {{- end -}} + {{- end -}} + {{- else if not .p1.IsNode -}} + {{- template "breadcrumbLink" (dict "page" .p1.Site.Home "position" .position) -}} {{- end -}} - {{- if not (eq .p1.RelPermalink "/pages/") -}} - {{- $title := .p1.Params.breadcrumb_title -}} - {{- if not $title -}}{{- $title = .p1.Title -}}{{- end }} - {{ if eq .p1 .p2 -}} - <li class="breadcrumb-item active" aria-current="page" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"> - {{- $title -}} - </li> - {{ else -}} - <li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"> - <a href="{{ .p1.Permalink }}">{{ $title }}</a> - </li> - {{ end -}} + {{- template "breadcrumbLink" (dict "page" .p1 "active" (eq .p1 .p2) "position" .position) -}} +{{- end -}} + +{{ define "breadcrumbLink" -}} + {{/* The pages root is not supposed to show, it's confusing with the home */}} + {{- if not (eq .page.RelPermalink "/pages/") -}} + {{- $title := .page.Params.breadcrumb_title -}} + {{- if not $title -}} + {{- $title = .page.Title -}} + {{- end -}} + {{- $title = chomp $title }} + <li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem" class="breadcrumb-item{{- if .active }} active{{ end }}"{{- if .active }} aria-current="page"{{ end }}> + {{ if .active -}} + <span itemprop="item"> + {{- else -}} + <a itemprop="item" href="{{ .page.Permalink }}"> + {{- end }} + <span itemprop="name">{{- $title -}}</span> + <meta itemprop="position" content="{{- .position -}}"> + {{ if .active -}} + </span> + {{- else -}} + </a> + {{- end }} + </li> {{- end -}} {{- end -}} \ No newline at end of file diff --git a/layouts/partials/pages/aside.html b/layouts/partials/pages/aside.html index 7febe025..3edb9e45 100644 --- a/layouts/partials/pages/aside.html +++ b/layouts/partials/pages/aside.html @@ -1,4 +1,4 @@ -<aside data-current="Test"> +<aside> <div> {{- partial "pages/toc.html" . -}} </div> diff --git a/layouts/partials/persons/person.html b/layouts/partials/persons/person.html index 484fba4b..15135d58 100644 --- a/layouts/partials/persons/person.html +++ b/layouts/partials/persons/person.html @@ -2,8 +2,8 @@ <div> {{- $title := partial "PrepareHTML" .Title }} <p class="name"><a href="{{ .Permalink }}">{{- $title -}}</a></p> - {{- if .Params.description_short }} - <p>{{- chomp (safeHTML (plainify .Params.description_short)) -}}</p> + {{- if partial "GetTextFromHTML" .Params.description_short }} + <p>{{- partial "PrepareHTML" .Params.description_short -}}</p> {{ else if (partial "GetTextFromHTML" .Content) }} <p>{{- partial "GetTruncateContent" .Content -}}</p> {{ end -}} diff --git a/layouts/partials/programs/admission.html b/layouts/partials/programs/admission.html index 838b7e01..82da9a38 100644 --- a/layouts/partials/programs/admission.html +++ b/layouts/partials/programs/admission.html @@ -1,9 +1,8 @@ +{{- if or (partial "GetTextFromHTML" .Params.prerequisites) (partial "GetTextFromHTML" .Params.pricing) (partial "GetTextFromHTML" .Params.registration) (partial "GetTextFromHTML" .Params.accessibility) (partial "GetTextFromHTML" .Params.other) -}} <section id="admission"> <div class="container"> <div class="content"> - <div> - <h2>{{ i18n "programs.toc.admission" }}</h2> - </div> + <h2>{{ i18n "programs.toc.admission" }}</h2> <div> {{- if partial "GetTextFromHTML" .Params.prerequisites -}} <div class="subpart"> @@ -19,17 +18,20 @@ </div> {{- end -}} - {{- if partial "GetTextFromHTML" .Params.accessibility -}} + {{- if partial "GetTextFromHTML" .Params.registration -}} <div class="subpart"> - <h3>{{ i18n "programs._accessibility" }}</h3> - {{- partial "PrepareHTML" .Params.accessibility -}} + <h3>{{ i18n "programs._registration" }}</h3> + {{- partial "PrepareHTML" .Params.registration -}} + {{- if partial "GetTextFromHTML" .Params.registration_url -}} + <p><a href="{{- partial "PrepareHTML" .Params.registration_url -}}" class="registration">{{ i18n "programs.apply" }}</a></p> + {{- end -}} </div> {{- end -}} - {{- if partial "GetTextFromHTML" .Params.registration -}} + {{- if partial "GetTextFromHTML" .Params.accessibility -}} <div class="subpart"> - <h3>{{ i18n "programs._registration" }}</h3> - {{- partial "PrepareHTML" .Params.registration -}} + <h3>{{ i18n "programs._accessibility" }}</h3> + {{- partial "PrepareHTML" .Params.accessibility -}} </div> {{- end -}} @@ -40,13 +42,48 @@ </div> {{- end -}} - {{- if partial "GetTextFromHTML" .Params.contacts -}} + {{- if .Params.roles -}} + <div class="subpart"> + <h3>{{ i18n "programs._roles" }}</h3> + {{- with .Params.roles -}} + {{- range . }} + {{ $title := .title }} + {{- range .persons -}} + {{ $slug := . }} + {{ with site.GetPage "persons" }} + {{ with .GetPage $slug }} + <p> + <b>{{ $title }}</b> + <br> + <a href="{{ .Permalink }}">{{ partial "PrepareHTML" .Title }}</a> + {{ if .Params.phone }} + <br> + {{ safeHTML .Params.phone }} + {{ end }} + {{ if .Params.email }} + <br> + <a href="mailto:{{ .Params.email }}" rel="noreferrer" target="_blank">{{ .Params.email }}</a> + {{ end }} + </p> + {{ end }} + {{ end }} + {{ end }} + {{ end -}} + {{- end -}} + </div> + {{- end -}} + + {{- if partial "GetTextFromHTML" .Params.contacts -}} <div class="subpart"> <h3>{{ i18n "programs._contacts" }}</h3> - {{- partial "PrepareHTML" .Params.contacts -}} + {{- if or (partial "GetTextFromHTML" .Params.contacts) -}} + {{- partial "PrepareHTML" .Params.contacts -}} + {{- end -}} </div> {{- end -}} + </div> </div> </div> </section> +{{- end -}} diff --git a/layouts/partials/programs/aside.html b/layouts/partials/programs/aside.html index 105f9c0a..6efd5c6d 100644 --- a/layouts/partials/programs/aside.html +++ b/layouts/partials/programs/aside.html @@ -1,8 +1,3 @@ <aside> - <div> - {{- partial "programs/toc.html" . -}} - {{ if .context.Params.main_information }} - {{- partial "PrepareHTML" .context.Params.main_information -}} - {{ end }} - </div> + {{- partial "programs/toc.html" . -}} </aside> diff --git a/layouts/partials/programs/essential.html b/layouts/partials/programs/essential.html new file mode 100644 index 00000000..bc5730ec --- /dev/null +++ b/layouts/partials/programs/essential.html @@ -0,0 +1,22 @@ +{{ $parent := .Params.parent }} +{{- with .Params.diplomas -}} + {{- $diploma := site.GetPage (printf "/diplomas/%s" .) -}} + {{- with $diploma -}} + <dl class="essential"> + <dt>{{ i18n "programs.diploma" }}</dt> + <dd><a href="{{ .Permalink }}">{{ partial "PrepareHTML" .Title }}</a></dd> + {{- if .Params.level -}} + <dt>{{ i18n "programs.level" }}</dt> + <dd>{{ partial "PrepareHTML" .Params.level }}</dd> + {{- end -}} + {{- with $parent -}} + <dt>{{ i18n "programs.mention" }}</dt> + <dd><a href="{{ .url }}">{{ partial "PrepareHTML" .title }}</a></dd> + {{- end -}} + {{- if .Params.duration -}} + <dt>{{ i18n "programs.duration" }}</dt> + <dd>{{ partial "PrepareHTML" .Params.duration }}</dd> + {{- end -}} + </dl> + {{- end -}} +{{- end -}} diff --git a/layouts/partials/programs/hero-single.html b/layouts/partials/programs/hero-single.html new file mode 100644 index 00000000..b90ce242 --- /dev/null +++ b/layouts/partials/programs/hero-single.html @@ -0,0 +1,26 @@ +{{- $title := or .Params.header_text .Title -}} +<header class="hero"> + <div class="container"> + {{- if .Params.breadcrumb | default true -}} + {{ partial "header/breadcrumbs.html" . }} + {{- end -}} + <div> + <h1>{{ partial "PrepareHTML" $title }}</h1> + </div> + </div> + <div id="essential"> + <div class="container"> + {{- with .Params.diplomas -}} + {{- $diploma := site.GetPage (printf "/diplomas/%s" .) -}} + {{- partial "diplomas/essential" $diploma -}} + {{- end -}} + <div class="dropdown-share dropup"> + <button type="button" id="shareProgram" data-bs-toggle="dropdown" aria-expanded="false">{{ i18n "commons.share" }}</button> + <div class="dropdown-menu"> + {{ partial "commons/share.html" . }} + </div> + </div> + </div> + </div> +</header> +{{ partial "programs/aside.html" . }} diff --git a/layouts/partials/programs/pedagogy.html b/layouts/partials/programs/pedagogy.html index 190ab305..e2368494 100644 --- a/layouts/partials/programs/pedagogy.html +++ b/layouts/partials/programs/pedagogy.html @@ -1,13 +1,15 @@ +{{- if or (partial "GetTextFromHTML" .Params.content) (partial "GetTextFromHTML" .Params.pedagogy) (partial "GetTextFromHTML" .Params.evaluation) (.Params.teachers) -}} <section id="pedagogy"> <div class="container"> <div class="content"> + <h2>{{ i18n "programs.toc.pedagogy" }}</h2> <div> - <h2>{{ i18n "programs.toc.pedagogy" }}</h2> - </div> - <div> - <div class="subpart"> - {{- partial "PrepareHTML" .Params.content -}} - </div> + {{- if partial "GetTextFromHTML" .Params.content -}} + <div class="subpart"> + <h3>{{ i18n "programs._content" }}</h3> + {{- partial "PrepareHTML" .Params.content -}} + </div> + {{- end -}} {{- if partial "GetTextFromHTML" .Params.pedagogy -}} <div class="subpart"> @@ -39,3 +41,4 @@ </div> </div> </section> +{{- end -}} diff --git a/layouts/partials/programs/presentation.html b/layouts/partials/programs/presentation.html index b292a7fb..84ef5290 100644 --- a/layouts/partials/programs/presentation.html +++ b/layouts/partials/programs/presentation.html @@ -1,15 +1,50 @@ <section id="presentation"> - {{ if .Params.objectives }} <div class="container"> <div class="content"> - <div> - <h2>{{ i18n "programs.toc.presentation" }}</h2> - </div> + <h2>{{ i18n "programs.toc.presentation" }}</h2> + <div> {{- partial "programs/image.html" .Params.image -}} - {{- partial "PrepareHTML" .Params.objectives -}} + {{- if partial "GetTextFromHTML" .Params.objectives -}} + {{- partial "PrepareHTML" .Params.objectives -}} + {{- end -}} + + <div class="subpart"> + <h3>{{ i18n "programs._administrative_information" }}</h3> + <table class="table table-infos"> + <caption>{{ i18n "programs._administrative_information" }}</caption> + <tbody> + {{- with .Params.diplomas -}} + {{- $diploma := site.GetPage (printf "/diplomas/%s" .) -}} + {{- with $diploma.Params.ects -}} + <tr> + <th>{{ i18n "programs.ects_credits" }}</th> + <td>{{ partial "PrepareHTML" . }}</td> + </tr> + {{- end -}} + {{- end -}} + <tr> + <th>{{ i18n "programs.type.initial" }}</th> + <td>{{ if .Params.initial }}{{ i18n "commons.true" }}{{ else }}{{ i18n "commons.false" }}{{ end }}</td> + </tr> + <tr> + <th>{{ i18n "programs.type.continuing" }}</th> + <td>{{ if .Params.continuing }}{{ i18n "commons.true" }}{{ else }}{{ i18n "commons.false" }}{{ end }}</td> + </tr> + <tr> + <th>{{ i18n "programs.type.apprenticeship" }}</th> + <td>{{ if .Params.apprenticeship }}{{ i18n "commons.true" }}{{ else }}{{ i18n "commons.false" }}{{ end }}</td> + </tr> + {{- if partial "GetTextFromHTML" .Params.capacity -}} + <tr> + <th>{{ i18n "programs.capacity" }}</th> + <td>{{ partial "PrepareHTML" .Params.capacity }}</td> + </tr> + {{- end -}} + </tbody> + </table> + </div> </div> </div> </div> - {{ end }} </section> diff --git a/layouts/partials/programs/results.html b/layouts/partials/programs/results.html index c289bfd7..bee436f9 100644 --- a/layouts/partials/programs/results.html +++ b/layouts/partials/programs/results.html @@ -1,9 +1,8 @@ +{{- if or (partial "GetTextFromHTML" .Params.opportunities) (partial "GetTextFromHTML" .Params.results) -}} <section id="results"> <div class="container"> <div class="content"> - <div> - <h2>{{ i18n "programs.toc.results" }}</h2> - </div> + <h2>{{ i18n "programs.toc.results" }}</h2> <div> {{- if partial "GetTextFromHTML" .Params.opportunities -}} <div class="subpart"> @@ -22,3 +21,4 @@ </div> </div> </section> +{{- end -}} diff --git a/layouts/partials/programs/show.html b/layouts/partials/programs/show.html index 80778d72..915457e8 100644 --- a/layouts/partials/programs/show.html +++ b/layouts/partials/programs/show.html @@ -1,48 +1,27 @@ -{{- $category := site.GetPage (printf "/categories%s" .Params.category) -}} -{{- $chapters := slice - "objectives" - "opportunities" - "results" - "informations" - "accessibility" - "duration" - "pricing" - "content" - "pedagogy" - "evaluation" - "prerequisites" - "registration" - "other" - "contacts" - "teachers" - -}} <article itemscope itemtype="https://schema.org/EducationalOccupationalCredential"> <meta itemprop="name" content="{{ partial "PrepareHTML" .Title }}"> <meta itemprop="url" content="{{ .Permalink }}"> - - {{- partial "programs/aside.html" - (dict - "category" $category - "chapters" $chapters - "context" . - ) - -}} - - {{- partial "blocks/list.html" .Params.blocks -}} - - <div> - <div class="container"> - {{- partial "programs/image.html" .Params.image -}} - {{- partial "programs/abstract.html" .Params.presentation -}} - {{- partial "programs/programs.html" .Pages -}} - {{- partial "programs/chapters.html" - (dict - "chapters" $chapters - "params" .Params - ) - -}} - {{- partial "posts/related.html" $category -}} - </div> + {{- if .Params.image -}} + {{- $id := .Params.image -}} + {{- if isset .Params.image "id" -}} + {{- $id = .Params.image.id -}} + {{- end -}} + {{- $image := partial "GetMedia" $id -}} + {{- if $image -}} + {{- $url := $image.url -}} + {{- if site.Params.keycdn -}} + {{- $url = $image.direct_url -}} + {{- end -}} + <meta itemprop="image" content="{{ $url }}"> + {{- end -}} + {{- end -}} + <div class="container"> + {{- partial "programs/abstract.html" .Params.presentation -}} </div> - + {{- partial "programs/children.html" .Pages -}} + {{- partial "programs/presentation.html" . -}} + {{- partial "blocks/list.html" .Params.blocks -}} + {{- partial "programs/pedagogy.html" . -}} + {{- partial "programs/results.html" . -}} + {{- partial "programs/admission.html" . -}} </article> diff --git a/layouts/partials/programs/toc.html b/layouts/partials/programs/toc.html index a34f5c82..73bf0556 100644 --- a/layouts/partials/programs/toc.html +++ b/layouts/partials/programs/toc.html @@ -1,28 +1,20 @@ -{{- $params := .context.Params -}} -{{- $contactsExist := or $params.contacts $params.roles -}} {{/* nav-link required for toggle active class */}} <nav class="toc" id="nav-toc" aria-label="{{ i18n "commons.toc" }}"> <ol> - {{- range .chapters -}} - {{- $content := index $params . -}} - {{- $chapterExists := $content -}} - {{ if eq "contacts" . }} - {{- $chapterExists = $contactsExist -}} - {{ end }} - {{- if $chapterExists }} - <li> - <a class="nav-link" href="#page-{{ . }}"> - {{- i18n (printf "programs._%s" .) -}} - </a> - </li> - {{- end -}} - {{- end -}} - {{- if .category.Pages }} - <li> - <a class="nav-link" href="#page-posts"> - {{- i18n "programs.posts" -}} - </a> - </li> - {{ end -}} + <li> + <a class="nav-link" href="#essential">{{ i18n "programs.toc.essential" }}</a> + </li> + <li> + <a class="nav-link" href="#presentation">{{ i18n "programs.toc.presentation" }}</a> + </li> + <li> + <a class="nav-link" href="#pedagogy">{{ i18n "programs.toc.pedagogy" }}</a> + </li> + <li> + <a class="nav-link" href="#results">{{ i18n "programs.toc.results" }}</a> + </li> + <li> + <a class="nav-link" href="#admission">{{ i18n "programs.toc.admission" }}</a> + </li> </ol> </nav> diff --git a/layouts/persons/single.html b/layouts/persons/single.html index 7f0d9e3a..9dd53f14 100644 --- a/layouts/persons/single.html +++ b/layouts/persons/single.html @@ -29,8 +29,13 @@ <div class="content"> <div> - {{ if (partial "GetTextFromHTML" .Content) }} + {{ if (partial "GetTextFromHTML" .Params.description_short) }} <div class="lead" itemprop="description"> + {{ partial "PrepareHTML" .Params.description_short }} + </div> + {{ end }} + {{ if (partial "GetTextFromHTML" .Content) }} + <div> {{ partial "PrepareHTML" .Content }} </div> {{ end }} diff --git a/layouts/programs/list.html b/layouts/programs/list.html index e48accea..56cde966 100644 --- a/layouts/programs/list.html +++ b/layouts/programs/list.html @@ -1,9 +1,9 @@ {{ define "main" }} - {{ partial "programs/hero.html" . }} - - {{ if or (eq .Params.diplomas "") (.Params.diplomas) }} + {{ if .Params.diplomas }} + {{ partial "programs/hero-single.html" . }} {{ partial "programs/show.html" . }} {{ else }} + {{ partial "programs/hero.html" . }} {{ partial "programs/index.html" . }} {{ end }} {{ end }} -- GitLab