From 69f2ee23a52393ee4d8f79debbfb231b6f2592d4 Mon Sep 17 00:00:00 2001
From: alexisben <alex@noesya.coop>
Date: Thu, 27 Oct 2022 18:22:46 +0200
Subject: [PATCH] blocks title refacto

---
 assets/sass/_theme/sections/programs.sass     |  9 ++++--
 layouts/administrators/list.html              |  4 +--
 layouts/authors/list.html                     |  4 +--
 layouts/diplomas/list.html                    |  2 +-
 layouts/diplomas/term.html                    |  2 +-
 layouts/index.html                            |  2 +-
 layouts/organizations/list.html               |  4 +--
 layouts/pages/list.html                       |  2 +-
 layouts/papers/list.html                      |  4 +--
 layouts/partials/blocks/list.html             | 10 +++++--
 .../blocks/templates/call_to_action.html      | 15 +++++-----
 .../partials/blocks/templates/chapter.html    | 12 +++++---
 .../partials/blocks/templates/contact.html    | 12 +++++---
 .../partials/blocks/templates/datatable.html  | 13 ++++++---
 .../blocks/templates/definitions.html         | 12 +++++---
 layouts/partials/blocks/templates/embed.html  | 12 +++++---
 layouts/partials/blocks/templates/files.html  | 12 +++++---
 .../partials/blocks/templates/gallery.html    | 12 +++++---
 layouts/partials/blocks/templates/image.html  | 11 +++-----
 .../blocks/templates/key_figures.html         | 14 ++++++----
 .../blocks/templates/organization_chart.html  | 14 ++++++----
 layouts/partials/blocks/templates/pages.html  | 12 +++++---
 .../partials/blocks/templates/partners.html   | 12 +++++---
 layouts/partials/blocks/templates/posts.html  | 28 +++++++++++--------
 .../partials/blocks/templates/programs.html   | 12 +++++---
 .../blocks/templates/testimonials.html        | 12 +++++---
 .../partials/blocks/templates/timeline.html   | 12 +++++---
 .../blocks/templates/timeline/horizontal.html |  5 +++-
 .../blocks/templates/timeline/vertical.html   |  5 +++-
 layouts/partials/blocks/templates/video.html  | 12 +++++---
 layouts/partials/blocks/title.html            | 23 +++++++++++++++
 layouts/partials/programs/index.html          |  2 +-
 layouts/partials/programs/presentation.html   |  1 +
 layouts/partials/programs/show.html           |  1 -
 layouts/persons/list.html                     |  4 +--
 layouts/posts/list.html                       |  6 ++--
 layouts/posts/single.html                     |  2 +-
 layouts/researchers/list.html                 |  5 ++--
 layouts/teachers/list.html                    |  5 ++--
 layouts/volumes/list.html                     |  4 +--
 40 files changed, 213 insertions(+), 132 deletions(-)
 create mode 100644 layouts/partials/blocks/title.html

diff --git a/assets/sass/_theme/sections/programs.sass b/assets/sass/_theme/sections/programs.sass
index 8d730a2c..25847c8c 100644
--- a/assets/sass/_theme/sections/programs.sass
+++ b/assets/sass/_theme/sections/programs.sass
@@ -134,9 +134,12 @@ ol.programs
                 padding: $spacing1/2 $spacing1
                 margin-bottom: 0
     .blocks
-        .block-content
-            @include media-breakpoint-up(md)
-                padding-left: offset(5)
+        .container
+            padding-left: 0
+            padding-right: 0
+        // .block-content
+            // @include media-breakpoint-up(md)
+                // padding-left: offset(5)
 
     @include media-breakpoint-up(md)
         article
diff --git a/layouts/administrators/list.html b/layouts/administrators/list.html
index 596729af..5a3eb132 100644
--- a/layouts/administrators/list.html
+++ b/layouts/administrators/list.html
@@ -7,9 +7,7 @@
     {{ partial "persons/chapo.html" .Params.description_short }}
   </div>
 
-  {{ if .Params.blocks }}
-    {{ partial "blocks/list.html" .Params.blocks }}
-  {{ end }}
+  {{ partial "blocks/list.html" . }}
 
   <div class="container">
     {{ partial "persons/list-specific.html" . }}
diff --git a/layouts/authors/list.html b/layouts/authors/list.html
index 596729af..5a3eb132 100644
--- a/layouts/authors/list.html
+++ b/layouts/authors/list.html
@@ -7,9 +7,7 @@
     {{ partial "persons/chapo.html" .Params.description_short }}
   </div>
 
-  {{ if .Params.blocks }}
-    {{ partial "blocks/list.html" .Params.blocks }}
-  {{ end }}
+  {{ partial "blocks/list.html" . }}
 
   <div class="container">
     {{ partial "persons/list-specific.html" . }}
diff --git a/layouts/diplomas/list.html b/layouts/diplomas/list.html
index 66ab3db6..1a864029 100644
--- a/layouts/diplomas/list.html
+++ b/layouts/diplomas/list.html
@@ -5,7 +5,7 @@
     {{ partial "diplomas/image.html" .Params.image }}
     {{ partial "diplomas/chapo.html" .Params.description_short }}
   </div>
-  {{ partial "blocks/list.html" .Params.blocks }}
+  {{ partial "blocks/list.html" . }}
   <div class="container">
     {{ .Scratch.Set "show_programs" true }}
     {{ partial "diplomas/diplomas.html" . }}
diff --git a/layouts/diplomas/term.html b/layouts/diplomas/term.html
index 8d248e7c..c36411a1 100644
--- a/layouts/diplomas/term.html
+++ b/layouts/diplomas/term.html
@@ -1,7 +1,7 @@
 {{ define "main" }}
   {{ partial "diplomas/hero-single.html" . }}
 
-  {{ partial "blocks/list.html" .Params.blocks }}
+  {{ partial "blocks/list.html" . }}
   <div class="container">
     {{ partial "programs/programs-list.html" .Pages }}
   </div>
diff --git a/layouts/index.html b/layouts/index.html
index c8d4e69c..442b07f9 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -3,7 +3,7 @@
 
   {{- if .Params.blocks }}
 
-    {{- partial "blocks/list.html" .Params.blocks -}}
+    {{- partial "blocks/list.html" . -}}
 
   {{ else }}
 
diff --git a/layouts/organizations/list.html b/layouts/organizations/list.html
index b1d01e05..03c9914c 100644
--- a/layouts/organizations/list.html
+++ b/layouts/organizations/list.html
@@ -6,7 +6,5 @@
     {{ partial "commons/pagination.html" . }}
   </div>
 
-  {{ if .Params.blocks }}
-    {{ partial "blocks/list.html" .Params.blocks }}
-  {{ end }}
+  {{ partial "blocks/list.html" . }}
 {{ end }}
diff --git a/layouts/pages/list.html b/layouts/pages/list.html
index f9824ccb..2ab017ce 100644
--- a/layouts/pages/list.html
+++ b/layouts/pages/list.html
@@ -17,7 +17,7 @@
               "context" .
           )
       }}
-      {{ partial "blocks/list.html" .Params.blocks }}
+      {{ partial "blocks/list.html" . }}
     </div>
   {{ else }}
     {{ partial "pages/image.html" .Params.image }}
diff --git a/layouts/papers/list.html b/layouts/papers/list.html
index 82f2c902..033ee638 100644
--- a/layouts/papers/list.html
+++ b/layouts/papers/list.html
@@ -10,7 +10,5 @@
     {{ partial "commons/pagination.html" . }}
   </div>
 
-  {{ if .Params.blocks }}
-    {{ partial "blocks/list.html" .Params.blocks }}
-  {{ end }}
+  {{ partial "blocks/list.html" . }}
 {{ end }}
diff --git a/layouts/partials/blocks/list.html b/layouts/partials/blocks/list.html
index db77cd0c..505a5224 100644
--- a/layouts/partials/blocks/list.html
+++ b/layouts/partials/blocks/list.html
@@ -1,8 +1,12 @@
-{{- if . -}}
+{{ $context := . }}
+{{- if .Params.blocks -}}
   <div class="blocks">
-  {{- range . -}}
+  {{- range .Params.blocks -}}
     {{ $template := printf "blocks/templates/%s.html" .template }}
-    {{ partial $template . }}
+    {{ partial $template (dict 
+        "block" . 
+        "context" $context
+    )}}
   {{- end -}}
   </div>
 {{- end -}}
diff --git a/layouts/partials/blocks/templates/call_to_action.html b/layouts/partials/blocks/templates/call_to_action.html
index 6f9b911f..9dfe74b7 100644
--- a/layouts/partials/blocks/templates/call_to_action.html
+++ b/layouts/partials/blocks/templates/call_to_action.html
@@ -1,16 +1,17 @@
-{{- $position := .position -}}
-{{- $title := .title -}}
-{{- with .data -}}
+{{- $context := .context -}}
+{{- $position := .block.position -}}
+{{- $title := .block.title -}}
+{{- with .block.data -}}
   {{- $buttons := and .button.text .button_secondary.text -}}
   <section class="block-call_to_action{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}">
     <div class="container">
       <div class="block-content">
         <div class="call_to_action call_to_action--with{{ if not .image }}out{{ end }}-image">
           <div>
-            {{- if $title }}
-              <h2>{{ partial "PrepareHTML" $title }}</h2>
-            {{- end -}}
-
+            {{ partial "blocks/title" (dict 
+              "title" $title
+              "context" $context
+              ) }}
             {{- if (partial "GetTextFromHTML" .text) }}
             <div>
               {{ partial "PrepareHTML" .text }}
diff --git a/layouts/partials/blocks/templates/chapter.html b/layouts/partials/blocks/templates/chapter.html
index c1db0600..a7f5a881 100644
--- a/layouts/partials/blocks/templates/chapter.html
+++ b/layouts/partials/blocks/templates/chapter.html
@@ -1,7 +1,8 @@
-{{- $position := .position -}}
-{{- $title := .title -}}
+{{- $context := .context -}}
+{{- $position := .block.position -}}
+{{- $title := .block.title -}}
 {{- $class := "block-chapter" -}}
-{{- with .data -}}
+{{- with .block.data -}}
   {{ if .image }}
     {{- $class = printf "%s block-chapter--with-image" $class -}}
   {{ end }}
@@ -12,7 +13,10 @@
         <div class="chapter">
           {{ if $title -}}
             <div class="top">
-              <h2>{{ partial "PrepareHTML" $title }}</h2>
+              {{ partial "blocks/title" (dict 
+                "title" $title
+                "context" $context
+                ) }}
             </div>
           {{ end -}}
           {{ if (partial "GetTextFromHTML" .text) -}}
diff --git a/layouts/partials/blocks/templates/contact.html b/layouts/partials/blocks/templates/contact.html
index 7d207261..26993d37 100644
--- a/layouts/partials/blocks/templates/contact.html
+++ b/layouts/partials/blocks/templates/contact.html
@@ -1,13 +1,17 @@
-{{- $position := .position -}}
-{{- $title := .title -}}
+{{- $context := .context -}}
+{{- $position := .block.position -}}
+{{- $title := .block.title -}}
 {{- $class := "block-contact" -}}
-{{- with .data -}}
+{{- with .block.data -}}
   <section class="{{ $class }}{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}">
     <div class="container">
       <div class="block-content">
         {{ if $title -}}
           <div class="top">
-            <h2>{{ partial "PrepareHTML" $title }}</h2>
+            {{ partial "blocks/title" (dict 
+              "title" $title
+              "context" $context
+              ) }}
           </div>
         {{ end -}}
         <address  itemscope itemtype="https://schema.org/Organization">
diff --git a/layouts/partials/blocks/templates/datatable.html b/layouts/partials/blocks/templates/datatable.html
index dfc2b4f6..34efcbac 100644
--- a/layouts/partials/blocks/templates/datatable.html
+++ b/layouts/partials/blocks/templates/datatable.html
@@ -1,12 +1,17 @@
-{{- $position := .position -}}
-{{- $title := .title -}}
-{{- with .data -}}
+{{- $context := .context -}}
+{{- $position := .block.position -}}
+{{- $title := .block.title -}}
+{{- $title := .block.title -}}
+{{- with .block.data -}}
   <section class="block-datatable{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}">
     <div class="container">
       <div class="block-content">
         {{- if $title }}
           <div class="top">
-            <h2>{{ partial "PrepareHTML" $title }}</h2>
+            {{ partial "blocks/title" (dict 
+              "title" $title
+              "context" $context
+              ) }}
           </div>
         {{ end -}}
         <div class="table-responsive">
diff --git a/layouts/partials/blocks/templates/definitions.html b/layouts/partials/blocks/templates/definitions.html
index 4e12b629..46eb0adb 100644
--- a/layouts/partials/blocks/templates/definitions.html
+++ b/layouts/partials/blocks/templates/definitions.html
@@ -1,12 +1,16 @@
-{{- $position := .position -}}
-{{- $title := .title -}}
-{{- with .data -}}
+{{- $context := .context -}}
+{{- $position := .block.position -}}
+{{- $title := .block.title -}}
+{{- with .block.data -}}
   <section class="block-definitions{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}">
     <div class="container">
       <div class="block-content">
         {{- if $title }}
           <div class="top">
-            <h2>{{ partial "PrepareHTML" $title }}</h2>
+            {{ partial "blocks/title" (dict 
+              "title" $title
+              "context" $context
+              ) }}
           </div>
         {{ end -}}
         <div class="definitions">
diff --git a/layouts/partials/blocks/templates/embed.html b/layouts/partials/blocks/templates/embed.html
index 71c0405a..157a4968 100644
--- a/layouts/partials/blocks/templates/embed.html
+++ b/layouts/partials/blocks/templates/embed.html
@@ -1,12 +1,16 @@
-{{- $position := .position -}}
-{{- $title := .title -}}
-{{- with .data -}}
+{{- $context := .context -}}
+{{- $position := .block.position -}}
+{{- $title := .block.title -}}
+{{- with .block.data -}}
   <section class="block-embed{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}">
     <div class="container">
       <div class="block-content">
         {{- if $title }}
           <div class="top">
-            <h2>{{ partial "PrepareHTML" $title }}</h2>
+            {{ partial "blocks/title" (dict 
+              "title" $title
+              "context" $context
+              ) }}
           </div>
         {{ end -}}
 
diff --git a/layouts/partials/blocks/templates/files.html b/layouts/partials/blocks/templates/files.html
index d8c2a0bf..2b81f50d 100644
--- a/layouts/partials/blocks/templates/files.html
+++ b/layouts/partials/blocks/templates/files.html
@@ -1,12 +1,16 @@
-{{- $position := .position -}}
-{{- $title := .title -}}
-{{- with .data -}}
+{{- $context := .context -}}
+{{- $position := .block.position -}}
+{{- $title := .block.title -}}
+{{- with .block.data -}}
   <section class="block-files{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}">
     <div class="container">
       <div class="block-content">
         {{- if $title }}
           <div class="top">
-            <h2>{{ partial "PrepareHTML" $title }}</h2>
+            {{ partial "blocks/title" (dict 
+              "title" $title
+              "context" $context
+              ) }}
           </div>
         {{ end -}}
         {{- if .description }}
diff --git a/layouts/partials/blocks/templates/gallery.html b/layouts/partials/blocks/templates/gallery.html
index 7d958ca6..83aa6f6a 100644
--- a/layouts/partials/blocks/templates/gallery.html
+++ b/layouts/partials/blocks/templates/gallery.html
@@ -1,7 +1,8 @@
-{{- $position := .position -}}
-{{- $title := .title -}}
+{{- $context := .context -}}
+{{- $position := .block.position -}}
+{{- $title := .block.title -}}
 {{- $layout_class := "block-gallery--grid" -}}
-{{- with .data -}}
+{{- with .block.data -}}
   {{- $layout := .layout -}}
   {{- if $layout -}}
     {{- $layout_class = printf "block-gallery--%s" .layout -}}
@@ -12,7 +13,10 @@
         {{- if (or $title .description) }}
           <div class="top">
             {{- if $title }}
-              <h2>{{ partial "PrepareHTML" $title }}</h2>
+            {{ partial "blocks/title" (dict 
+              "title" $title
+              "context" $context
+              ) }}
             {{ end -}}
             {{- if .description }}
               <div class="description">
diff --git a/layouts/partials/blocks/templates/image.html b/layouts/partials/blocks/templates/image.html
index cc952a48..84e1ab73 100644
--- a/layouts/partials/blocks/templates/image.html
+++ b/layouts/partials/blocks/templates/image.html
@@ -1,14 +1,11 @@
-{{- $position := .position -}}
-{{- $title := .title -}}
-{{- with .data -}}
+{{- $context := .context -}}
+{{- $position := .block.position -}}
+{{- $title := .block.title -}}
+{{- with .block.data -}}
   {{- $buttons := and .button.text .button_secondary.text -}}
   <section class="block-image{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}">
     <div class="container">
       <div class="block-content">
-        <div>
-          {{- if $title }}
-          {{ end -}}
-        </div>
         {{/*  TODO: refactor  */}}
         {{- with .image -}}
           {{- $image := partial "GetMedia" .file -}}
diff --git a/layouts/partials/blocks/templates/key_figures.html b/layouts/partials/blocks/templates/key_figures.html
index 25e96aaf..856371fe 100644
--- a/layouts/partials/blocks/templates/key_figures.html
+++ b/layouts/partials/blocks/templates/key_figures.html
@@ -1,14 +1,16 @@
-{{- $position := .position -}}
-{{- $title := .title -}}
-{{- with .data -}}
+{{- $context := .context -}}
+{{- $position := .block.position -}}
+{{- $title := .block.title -}}
+{{- with .block.data -}}
   <section class="block-key_figures{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}">
     <div class="container">
       <div class="block-content">
         {{- if (or $title .description) }}
           <div class="top">
-            {{- if $title }}
-              <h2>{{ partial "PrepareHTML" $title }}</h2>
-            {{ end -}}
+            {{ partial "blocks/title" (dict 
+              "title" $title
+              "context" $context
+              ) }}
             {{- if .description }}
               <div class="description">
                 {{ partial "PrepareHTML"  .description }}
diff --git a/layouts/partials/blocks/templates/organization_chart.html b/layouts/partials/blocks/templates/organization_chart.html
index 229462fd..0ffa8dc3 100644
--- a/layouts/partials/blocks/templates/organization_chart.html
+++ b/layouts/partials/blocks/templates/organization_chart.html
@@ -1,15 +1,17 @@
-{{- $position := .position -}}
-{{- $title := .title -}}
-{{- with .data -}}
+{{- $context := .context -}}
+{{- $position := .block.position -}}
+{{- $title := .block.title -}}
+{{- with .block.data -}}
   {{- $with_link := .with_link -}}
 <section class="block-organization_chart{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}">
   <div class="container">
     <div class="block-content">
         {{ if (or $title .description) -}}
           <div class="top">
-            {{- if $title }}
-              <h2>{{ partial "PrepareHTML" $title }}</h2>
-            {{ end -}}
+            {{ partial "blocks/title" (dict 
+              "title" $title
+              "context" $context
+              ) }}
             {{- if .description }}
               <div class="description">
                 {{ partial "PrepareHTML"  .description }}
diff --git a/layouts/partials/blocks/templates/pages.html b/layouts/partials/blocks/templates/pages.html
index 0892765a..c68b0daa 100644
--- a/layouts/partials/blocks/templates/pages.html
+++ b/layouts/partials/blocks/templates/pages.html
@@ -1,7 +1,8 @@
-{{- $position := .position -}}
-{{- $title := .title -}}
+{{- $context := .context -}}
+{{- $position := .block.position -}}
+{{- $title := .block.title -}}
 {{- $layout_class := "block-pages--grid" -}}
-{{- with .data -}}
+{{- with .block.data -}}
   {{- $layout := .layout -}}
 
   {{- $show_main_page := false -}}
@@ -41,7 +42,10 @@
 
         {{- if and $title (not $show_main_page) }}
           <div class="top">
-            <h2>{{ partial "PrepareHTML" $title }}</h2>
+            {{ partial "blocks/title" (dict 
+              "title" $title
+              "context" $context
+              ) }}
           </div>
         {{ end -}}
 
diff --git a/layouts/partials/blocks/templates/partners.html b/layouts/partials/blocks/templates/partners.html
index 2b3207b1..21374093 100644
--- a/layouts/partials/blocks/templates/partners.html
+++ b/layouts/partials/blocks/templates/partners.html
@@ -1,13 +1,17 @@
-{{- $position := .position -}}
-{{- $title := .title -}}
-{{- with .data -}}
+{{- $context := .context -}}
+{{- $position := .block.position -}}
+{{- $title := .block.title -}}
+{{- with .block.data -}}
   <section class="block-partners{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}">
     <div class="container">
       <div class="block-content">
         {{ if (or $title .description) -}}
           <div class="top">
             {{- if $title }}
-              <h2>{{ partial "PrepareHTML" $title }}</h2>
+              {{ partial "blocks/title" (dict 
+                "title" $title
+                "context" $context
+                ) }}
             {{ end -}}
             {{- if .description }}
               <div class="description">
diff --git a/layouts/partials/blocks/templates/posts.html b/layouts/partials/blocks/templates/posts.html
index d43428a6..210a8074 100644
--- a/layouts/partials/blocks/templates/posts.html
+++ b/layouts/partials/blocks/templates/posts.html
@@ -1,7 +1,8 @@
-{{- $position := .position -}}
-{{- $title := .title -}}
+{{- $context := .context -}}
+{{- $position := .block.position -}}
+{{- $title := .block.title -}}
 {{- $term := false -}}
-{{- with .data }}
+{{- with .block.data }}
   {{ if .category }}
     {{- $term = site.GetPage (printf "/categories%s" .category) -}}
   {{ end }}
@@ -10,15 +11,18 @@
       <div class="block-content">
         {{ if $title -}}
           <div class="top">
-            <h2>
-              {{- if $term -}}
-                <a href="{{ $term.Permalink }}">
-              {{- end -}}
-                {{- partial "PrepareHTML" $title -}}
-              {{- if $term -}}
-                </a>
-              {{- end -}}
-            </h2>
+
+            {{ $title_link := false }}
+            {{- if $term }}
+              {{ $title_link = $term.Permalink }}
+            {{ end -}}
+
+            {{ partial "blocks/title" (dict 
+              "title" $title
+              "context" $context
+              "link" $title_link
+              ) }}
+
           </div>
         {{- end }}
 
diff --git a/layouts/partials/blocks/templates/programs.html b/layouts/partials/blocks/templates/programs.html
index e404f8e5..d32ed8c2 100644
--- a/layouts/partials/blocks/templates/programs.html
+++ b/layouts/partials/blocks/templates/programs.html
@@ -1,12 +1,16 @@
-{{- $position := .position -}}
-{{- $title := .title -}}
-{{- with .data -}}
+{{- $context := .context -}}
+{{- $position := .block.position -}}
+{{- $title := .block.title -}}
+{{- with .block.data -}}
   <section class="block-programs{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}">
     <div class="container">
       <div class="block-content">
         {{ if $title -}}
           <div class="top">
-            <h2>{{ partial "PrepareHTML" $title }}</h2>
+            {{ partial "blocks/title" (dict 
+              "title" $title
+              "context" $context
+              ) }}
           </div>
         {{ end -}}
 
diff --git a/layouts/partials/blocks/templates/testimonials.html b/layouts/partials/blocks/templates/testimonials.html
index 8a1e6d73..a1c82e54 100644
--- a/layouts/partials/blocks/templates/testimonials.html
+++ b/layouts/partials/blocks/templates/testimonials.html
@@ -1,8 +1,9 @@
-{{- $position := .position -}}
-{{- $title := .title -}}
+{{- $context := .context -}}
+{{- $position := .block.position -}}
+{{- $title := .block.title -}}
 {{- $is_carousel := false -}}
 
-{{- with .data -}}
+{{- with .block.data -}}
   {{ if gt (len .testimonials) 1 }}
     {{- $is_carousel = true -}}
   {{ end }}
@@ -11,7 +12,10 @@
       <div class="block-content">
         {{ if $title -}}
           <div class="top">
-            <h2>{{ partial "PrepareHTML" $title }}</h2>
+            {{ partial "blocks/title" (dict 
+              "title" $title
+              "context" $context
+              ) }}
           </div>
         {{ end -}}
 
diff --git a/layouts/partials/blocks/templates/timeline.html b/layouts/partials/blocks/templates/timeline.html
index 0290d6c3..aadcf57f 100644
--- a/layouts/partials/blocks/templates/timeline.html
+++ b/layouts/partials/blocks/templates/timeline.html
@@ -1,10 +1,14 @@
-{{- $position := .position -}}
-{{- $title := .title -}}
-{{- $layout := .data.layout | default "vertical" -}}
+{{- $context := .context -}}
+{{- $position := .block.position -}}
+{{- $title := .block.title -}}
+{{- $layout := .block.data.layout | default "vertical" -}}
 <section class="block-timeline{{ if $title }} block-with-title{{ end }} block-timeline--{{ $layout }}" id="block-{{ $position }}">
   <div class="container">
     {{ $template := printf "blocks/templates/timeline/%s.html" $layout }}
-    {{ partial $template . }}
+    {{ partial $template (dict 
+        "block" .
+        "context" $context
+      ) }}
   </div>
 </section>
 
diff --git a/layouts/partials/blocks/templates/timeline/horizontal.html b/layouts/partials/blocks/templates/timeline/horizontal.html
index a4e9bc05..9b10d866 100644
--- a/layouts/partials/blocks/templates/timeline/horizontal.html
+++ b/layouts/partials/blocks/templates/timeline/horizontal.html
@@ -1,6 +1,9 @@
 <div class="timeline">
   {{ if .title }}
-    <h2>{{ partial "PrepareHTML" .title }}</h2>
+    {{ partial "blocks/title" (dict 
+    "title" .title
+    "context" .context
+    ) }}
   {{ end }}
 
   {{ with .data }}
diff --git a/layouts/partials/blocks/templates/timeline/vertical.html b/layouts/partials/blocks/templates/timeline/vertical.html
index 94ec914b..d3ec9fe5 100644
--- a/layouts/partials/blocks/templates/timeline/vertical.html
+++ b/layouts/partials/blocks/templates/timeline/vertical.html
@@ -1,7 +1,10 @@
 <div class="block-content">
   {{ if .title -}}
     <div class="top">
-      <h2>{{ partial "PrepareHTML" .title }}</h2>
+      {{ partial "blocks/title" (dict 
+        "title" .title
+        "context" .context
+        ) }}
     </div>
   {{- end }}
 
diff --git a/layouts/partials/blocks/templates/video.html b/layouts/partials/blocks/templates/video.html
index 055aaa53..60532489 100644
--- a/layouts/partials/blocks/templates/video.html
+++ b/layouts/partials/blocks/templates/video.html
@@ -1,13 +1,17 @@
-{{- $position := .position -}}
-{{- $title := .title -}}
-{{- with .data -}}
+{{- $context := .context -}}
+{{- $position := .block.position -}}
+{{- $title := .block.title -}}
+{{- with .block.data -}}
   <section class="block-video{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}">
     <div class="container">
       <div class="block-content">
         <div>
           {{ if $title -}}
             <div class="top">
-              <h2>{{ partial "PrepareHTML" $title }}</h2>
+              {{ partial "blocks/title" (dict 
+                "title" $title
+                "context" $context
+                ) }}
             </div>
           {{ end -}}
 
diff --git a/layouts/partials/blocks/title.html b/layouts/partials/blocks/title.html
new file mode 100644
index 00000000..9169f387
--- /dev/null
+++ b/layouts/partials/blocks/title.html
@@ -0,0 +1,23 @@
+{{- if .title }}
+  {{- if ne .context.Type "programs" }}
+    <h2>
+      {{- if .link -}}
+        <a href="{{ .link }}">
+      {{- end -}}
+      {{ partial "PrepareHTML" .title }}
+      {{- if .link -}}
+        </a>
+      {{- end -}}
+    </h2>
+  {{ else }}
+    <h3>
+      {{- if .link -}}
+        <a href="{{ .link }}">
+      {{- end -}}
+      {{ partial "PrepareHTML" .title }}
+      {{- if .link -}}
+        </a>
+      {{- end -}}
+    </h3>
+  {{ end -}}
+{{ end -}}
\ No newline at end of file
diff --git a/layouts/partials/programs/index.html b/layouts/partials/programs/index.html
index fa6ae824..c431afc0 100644
--- a/layouts/partials/programs/index.html
+++ b/layouts/partials/programs/index.html
@@ -2,7 +2,7 @@
   {{ partial "programs/image.html" .Params.image }}
   {{ partial "programs/chapo.html" .Params.description_short }}
 </div>
-{{ partial "blocks/list.html" .Params.blocks }}
+{{ partial "blocks/list.html" . }}
 <div class="container">
   {{ partial "diplomas/diplomas-select.html" . }}
   {{ $programs := where .Site.Pages "Section" "programs" }}
diff --git a/layouts/partials/programs/presentation.html b/layouts/partials/programs/presentation.html
index 84ef5290..c2fe07db 100644
--- a/layouts/partials/programs/presentation.html
+++ b/layouts/partials/programs/presentation.html
@@ -45,6 +45,7 @@
             </table>
           </div>
         </div>
+        {{- partial "blocks/list.html" . }}
       </div>
     </div>
 </section>
diff --git a/layouts/partials/programs/show.html b/layouts/partials/programs/show.html
index 915457e8..8b8e3fd3 100644
--- a/layouts/partials/programs/show.html
+++ b/layouts/partials/programs/show.html
@@ -20,7 +20,6 @@
   </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" . -}}
diff --git a/layouts/persons/list.html b/layouts/persons/list.html
index 2275cd5a..543a5047 100644
--- a/layouts/persons/list.html
+++ b/layouts/persons/list.html
@@ -18,8 +18,6 @@
     {{- end -}}
   </div>
 
-  {{ if .Params.blocks }}
-    {{ partial "blocks/list.html" .Params.blocks }}
-  {{ end }}
+  {{ partial "blocks/list.html" . }}
 
 {{ end }}
diff --git a/layouts/posts/list.html b/layouts/posts/list.html
index 6b76a733..428fa21c 100644
--- a/layouts/posts/list.html
+++ b/layouts/posts/list.html
@@ -6,9 +6,9 @@
     {{ partial "posts/image.html" .Params.image }}
     {{ partial "posts/chapo.html" .Params.description_short }}
   </div>
-  {{ if .Params.blocks }}
-    {{ partial "blocks/list.html" .Params.blocks }}
-  {{ end }}
+
+  {{ partial "blocks/list.html" . }}
+
   <div class="container">
     {{ partial "posts/posts.html" . }}
     {{ partial "commons/pagination.html" . }}
diff --git a/layouts/posts/single.html b/layouts/posts/single.html
index 01a934be..49bb3bb4 100644
--- a/layouts/posts/single.html
+++ b/layouts/posts/single.html
@@ -19,7 +19,7 @@
           </div>
         </div>
       </div>
-      {{ partial "blocks/list.html" .Params.blocks }}
+      {{ partial "blocks/list.html" . }}
       <div class="blocks blocks-pagination">
         <div class="container">
           <div class="block-content">
diff --git a/layouts/researchers/list.html b/layouts/researchers/list.html
index 596729af..45063450 100644
--- a/layouts/researchers/list.html
+++ b/layouts/researchers/list.html
@@ -7,9 +7,8 @@
     {{ partial "persons/chapo.html" .Params.description_short }}
   </div>
 
-  {{ if .Params.blocks }}
-    {{ partial "blocks/list.html" .Params.blocks }}
-  {{ end }}
+
+  {{ partial "blocks/list.html" . }}
 
   <div class="container">
     {{ partial "persons/list-specific.html" . }}
diff --git a/layouts/teachers/list.html b/layouts/teachers/list.html
index 596729af..45063450 100644
--- a/layouts/teachers/list.html
+++ b/layouts/teachers/list.html
@@ -7,9 +7,8 @@
     {{ partial "persons/chapo.html" .Params.description_short }}
   </div>
 
-  {{ if .Params.blocks }}
-    {{ partial "blocks/list.html" .Params.blocks }}
-  {{ end }}
+
+  {{ partial "blocks/list.html" . }}
 
   <div class="container">
     {{ partial "persons/list-specific.html" . }}
diff --git a/layouts/volumes/list.html b/layouts/volumes/list.html
index ec0a71d9..e896be83 100644
--- a/layouts/volumes/list.html
+++ b/layouts/volumes/list.html
@@ -5,7 +5,5 @@
     {{ partial "commons/pagination.html" . }}
   </div>
 
-  {{ if .Params.blocks }}
-    {{ partial "blocks/list.html" .Params.blocks }}
-  {{ end }}
+  {{ partial "blocks/list.html" . }}
 {{ end }}
-- 
GitLab