adhesiones-jekyll-theme 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc3c11222a90efa3fbd0a04ff8b7c0f6f88b4d35347b14d13c910a38cfa62069
4
- data.tar.gz: fa39f4de8901a80f29760d6764d9dd39a96654626a4b65264e5c86f89f112328
3
+ metadata.gz: 9ce78bd66e33c792602efc2258fbaadeb6fbeb3087b3b3f8f2faa74440a2fb85
4
+ data.tar.gz: 85bb251b162375ccd329ee06aa0d67c0a682a692bdccec280bc062684a6ed7e9
5
5
  SHA512:
6
- metadata.gz: 40a36146b85df044dec63d0c7cb983b139dc247522622a60d6c87585620891e2a51b8c3606cfeda217e51d9aeb146f6b3ae835426c628c8b4adc0cd6f9d9e281
7
- data.tar.gz: 285fc3c51bf75b03fa0cf692abbd46b114a82054a45ce79dce73f1ef8d2087770d51f90f826d7c4d747bbcc164dcc38de774c0a7098b02240884a05b6350b12a
6
+ metadata.gz: ec5869ad085dcccbb99df579084752c6f1fd6a4f91b1f1f85c7d8329f3dfc1bd2b0ca26d22c28c6c1dc0698f638012d04380c16e493dbc683af2ab7035ff6977
7
+ data.tar.gz: 762c342799cbac74755b05c26614295648c7aec014fe9524c4b87e805a84ee5c758912e03d91f0db9f7813324e81d6bcc3306cf5f8025d8290f9801a8906ca84
data/README.md CHANGED
@@ -4,32 +4,83 @@ CAMBIAME: Esta es una plantilla base para comenzar cualquier plantilla
4
4
  relacionada con Sutty, con el entorno de desarrollo que usamos según
5
5
  nuestro flujo de trabajo.
6
6
 
7
- La instalación de esta gema se realiza bifurcando el desarrollo de esta
8
- usando git, por ejemplo:
9
-
10
7
  ```bash
11
- # Hacer un fork local desde sutty-base-jekyll-theme a nuestra plantilla
12
- git clone https://0xacab.org/sutty/jekyll/sutty-base-jekyll-theme.git \
13
- CAMBIAME-jekyll-theme
8
+ # Desde el directorio de trabajo
9
+ cd ~/Sutty
10
+ # Instalar sutty-cli antes de empezar
11
+ gem install sutty-cli
12
+ # Iniciar una plantilla
13
+ sutty-cli theme CAMBIAME
14
+ # Se creó el repositorio
14
15
  cd CAMBIAME-jekyll-theme
16
+ ```
15
17
 
16
- # Sutty-base ahora es el proyecto base, desde el que podemos tomar
17
- # cambios, pero no enviamos para no mezclar las cosas
18
- git remote rename origin upstream
18
+ Para empezar, hay que buscar y reemplazar en todos los archivos donde
19
+ diga `CAMBIAME`.
19
20
 
20
- # Agregamos el repositorio donde vamos a enviar y publicar cambios
21
- git remote add origin \
22
- git@0xacab.org:sutty/jekyll/CAMBIAME-jekyll-theme.git
21
+ También hay que instalar
22
+ [sutty.local](https://0xacab.org/sutty/sutty.local/):
23
23
 
24
- # Configuramos git para que envíe siempre los cambios al repositorio
25
- # nuevo
26
- git push --set-upstream origin master
24
+ ```bash
25
+ # Desde el directorio de trabajo
26
+ cd ~/Sutty
27
+ # Clonar el repositorio
28
+ git clone https://0xacab.org/sutty/sutty.local.git
29
+ cd sutty.local
30
+ make all domain domain=sutty.local
31
+ cd .. # Volver al directorio de trabajo
27
32
  ```
28
33
 
29
- Para empezar, hay que buscar y reemplazar en todos los archivos donde
30
- diga `CAMBIAME`.
34
+ Esto genera un certificado a nivel local que luego va a usar el
35
+ servidor de desarrollo.
36
+
37
+ ## Desarrollo
38
+
39
+ Siempre trabajamos desde el directorio raíz del repositorio:
40
+
41
+ ```bash
42
+ cd ~/Sutty/CAMBIAME-jekyll-theme
43
+ ```
44
+
45
+ Primero hay que iniciar los servidores, antes hay que instalar el
46
+ paquete `nghttp2`.
47
+
48
+ ```bash
49
+ make serve
50
+ ```
31
51
 
32
- También hay que instalar las dependencias de CSS y JS con `yarn`.
52
+ A partir de este momento podemos editar los archivos. Para probar lo
53
+ que estamos haciendo, compilamos el sitio.
54
+
55
+ ```bash
56
+ make build
57
+ ```
58
+
59
+ Hay que hacer esto cada vez que queremos probar cambios.
60
+
61
+ **Nota:** No usamos `jekyll serve` porque entra en conflicto con algunos
62
+ de nuestros complementos y los sitios grandes tardan en compilarse de
63
+ todas formas.
64
+
65
+ ## Actualizar
66
+
67
+ Podemos traer cambios de la base:
68
+
69
+ ```bash
70
+ git pull upstream master
71
+ ```
72
+
73
+ Si hubiera conflictos, los podemos resolver con:
74
+
75
+ ```bash
76
+ # Esto se hace una sola vez, cambiar vimdiff por la herramienta que
77
+ # queramos usar
78
+ git config --global mergetool.tool vimdiff
79
+ git config --global mergetool.keepBackup false
80
+
81
+ # Resolver los conflictos
82
+ git mergetool
83
+ ```
33
84
 
34
85
  ## Publicación
35
86
 
data/_config.yml CHANGED
@@ -4,16 +4,34 @@ hostname: 'adhesiones.sutty.nl'
4
4
  title: 'Adhesiones'
5
5
  plugins:
6
6
  - jekyll-locales
7
+ - jekyll-ignore-layouts
7
8
  - jekyll-relative-urls
9
+ - jekyll-dotenv
10
+ - jekyll-include-cache
11
+ - jekyll-linked-posts
12
+ - jekyll-commonmark
8
13
  - jekyll-feed
14
+ - jekyll-order
15
+ - jekyll-data
9
16
  - jekyll-seo-tag
10
17
  - jekyll-images
11
- - jekyll-include-cache
18
+ - sutty-liquid
19
+ markdown: CommonMark
20
+ commonmark:
21
+ options:
22
+ - SMART
23
+ - FOOTNOTES
24
+ - UNSAFE
25
+ extensions:
26
+ - strikethrough
27
+ - autolink
28
+ - table
12
29
  # Agregar node_modules a la lista de directorios donde SASS busca
13
30
  # archivos. Podríamos haber agregado solo "node_modules/bootstrap/scss"
14
31
  # pero queríamos dejarlo abierto para poder cambiar de framework o
15
32
  # llamar a varios a la vez.
16
33
  sass:
34
+ style: compressed
17
35
  load_paths:
18
36
  - node_modules
19
37
  # Opciones para generar las URLs de las páginas. Por defecto Jekyll
@@ -40,6 +58,11 @@ images:
40
58
  - 768
41
59
  - 992
42
60
  - 1140
43
-
44
61
  locales:
45
62
  - es
63
+ ignored_layouts:
64
+ - menu
65
+ linked_fields:
66
+ - post
67
+ - item
68
+ - items
data/_data/en.yml CHANGED
@@ -1,50 +1,101 @@
1
1
  ---
2
- locale: Inglés
2
+ locale: English
3
3
  date: '%m/%d/%Y'
4
+ date:
5
+ format: '%m/%d/%Y'
6
+ abbr_day_names:
7
+ - Mon
8
+ - Tue
9
+ - Wed
10
+ - Thu
11
+ - Fri
12
+ - Sat
13
+ - Sun
14
+ day_names:
15
+ - Monday
16
+ - Tuesday
17
+ - Wednesday
18
+ - Thursday
19
+ - Friday
20
+ - Saturday
21
+ - Sunday
22
+ abbr_month_names:
23
+ - Jan
24
+ - Feb
25
+ - Mar
26
+ - Apr
27
+ - May
28
+ - Jun
29
+ - Jul
30
+ - Aug
31
+ - Sep
32
+ - Oct
33
+ - Nov
34
+ - Dec
35
+ month_names:
36
+ - January
37
+ - February
38
+ - March
39
+ - April
40
+ - May
41
+ - June
42
+ - July
43
+ - August
44
+ - September
45
+ - October
46
+ - November
47
+ - December
48
+ time:
49
+ am: am
50
+ pm: pm
4
51
  layouts:
5
52
  post: Article
6
- adhesion: Endorsement
7
- home:
8
- campaign:
9
- text: Create your campaign
10
- url: https://sutty.nl/en/
11
- print:
12
- text: Print
13
- icon: print
14
- form:
15
- title: Join the struggle
16
- submit: Endorse
17
- adhesiones: Endorsements
18
- metric: signaturas
19
- share_post:
20
- text: Share your endorsement
21
- icon: share-alt
22
- footer: "Site made with [Sutty](https://sutty.nl/en/), designed by [librenauta](https://copiona.com/) - [Create your campaign here](https://sutty.nl/)"
53
+ menu: Menu
23
54
  share:
24
55
  text: Share
25
56
  icon: share-square
26
57
  items:
27
- - title: Fediverse
28
- url: "https://fediverse.sutty.nl/en/?u=%url&t=%title&d=%description"
29
- icon: mastodon-alt
30
- - title: Facebook
31
- url: "https://www.facebook.com/sharer/sharer.php?u=%url&t=%title%0A%0A%description"
32
- icon: facebook-official
33
58
  - title: Twitter
34
- url: "https://twitter.com/intent/tweet?url=%url&text=%title%0A%0A%description&hashtags=ContamosConVoz"
59
+ url: "https://twitter.com/intent/tweet?url=%url&text=%title%0A%0A%description&hashtags=%tags"
35
60
  icon: twitter
61
+ - title: Facebook
62
+ url: "https://www.facebook.com/sharer/sharer.php?u=%url&t=%title%0A%0A%description"
63
+ icon: facebook-official
36
64
  - title: Whatsapp
37
65
  url: "https://api.whatsapp.com/send?text=%title%0A%0A%description%0A%0A%url"
38
66
  icon: whatsapp
39
67
  - title: Telegram
40
- url: "https://t.me/share/url?url=%url&text=%title%0A%0A%description"
68
+ url: "https://t.me/share/url?url=%url&text=%title%0A%0A%description"
41
69
  icon: telegram
42
70
  - title: Tumblr
43
- url: "https://www.tumblr.com/widgets/share/tool?canonicalUrl=%url&title=%title&caption=%description&tags=ContamosConVoz"
71
+ url: "https://www.tumblr.com/widgets/share/tool?canonicalUrl=%url&title=%title&caption=%description&tags=%tags"
44
72
  icon: tumblr
45
73
  - title: Reddit
46
- url: "https://reddit.com/submit?url=%url&title=ConVozContamos%20-%20%title"
74
+ url: "https://reddit.com/submit?url=%url&title=%tags%20-%20%title"
47
75
  icon: reddit
48
76
  - title: E-mail
49
- url: "mailto:?subject=%title&body=%description%0A%0A%url"
77
+ url: "mailto:?subject=%title&body=%description%0A%0A%url"
50
78
  icon: envelope
79
+ - title: Fediverse
80
+ url: "https://fediverse.sutty.nl/en/?u=%url&t=%title&d=%description%20%tags"
81
+ icon: mastodon-alt
82
+ layouts:
83
+ post: Article
84
+ adhesion: Endorsement
85
+ home:
86
+ campaign:
87
+ text: Create your campaign
88
+ url: https://sutty.nl/en/
89
+ print:
90
+ text: Print
91
+ icon: print
92
+ form:
93
+ title: Join the struggle
94
+ submit: Endorse
95
+ submit_help: "To prevent spam, please wait <span data-seconds>30</span> seconds before submitting."
96
+ adhesiones: Endorsements
97
+ metric: signaturas
98
+ share_post:
99
+ text: Share your endorsement
100
+ icon: share-alt
101
+ footer: "Site made with [Sutty](https://sutty.nl/en/), designed by [librenauta](https://copiona.com/) - [Create your campaign here](https://sutty.nl/)"
data/_data/es.yml CHANGED
@@ -1,53 +1,102 @@
1
1
  ---
2
2
  locale: Castellano
3
- date: '%d/%m/%Y'
3
+ date:
4
+ format: '%d/%m/%Y'
5
+ abbr_day_names:
6
+ - Lun
7
+ - Mar
8
+ - Mié
9
+ - Jue
10
+ - Vie
11
+ - Sáb
12
+ - Dom
13
+ day_names:
14
+ - Lunes
15
+ - Martes
16
+ - Miércoles
17
+ - Jueves
18
+ - Viernes
19
+ - Sábado
20
+ - Domingo
21
+ abbr_month_names:
22
+ - Ene
23
+ - Feb
24
+ - Mar
25
+ - Abr
26
+ - May
27
+ - Jun
28
+ - Jul
29
+ - Ago
30
+ - Sep
31
+ - Oct
32
+ - Nov
33
+ - Dic
34
+ month_names:
35
+ - Enero
36
+ - Febrero
37
+ - Marzo
38
+ - Abril
39
+ - Mayo
40
+ - Junio
41
+ - Julio
42
+ - Agosto
43
+ - Septiembre
44
+ - Octubre
45
+ - Noviembre
46
+ - Diciembre
47
+ time:
48
+ am: am
49
+ pm: pm
4
50
  layouts:
5
51
  post: Artículo
6
52
  adhesion: Adhesión
7
53
  adhesion_individual: Adhesión individual
8
- home:
9
- campaign:
10
- text: Creá tu campaña
11
- url: https://sutty.nl/
12
- print:
13
- text: Imprimir
14
- icon: print
15
- form:
16
- title: Sumá tu adhesión
17
- submit: Adherir
18
- adhesion: Adherir como organización
19
- adhesion_individual: Adherir como individue
20
- adhesiones: Adhesiones
21
- metric: firmas
22
- share_post:
23
- text: Compartir adhesión
24
- icon: share-alt
25
- footer: "Sitio hecho con [Sutty](https://sutty.nl/es/), diseño por [librenauta](https://copiona.com/) - creá tu campaña [aquí](https://sutty.nl/)"
54
+ menu: Menú
26
55
  share:
27
56
  text: Compartir
28
57
  icon: share-square
29
58
  items:
30
- - title: Fediverso
31
- url: "https://fediverse.sutty.nl/es/?u=%url&t=%title&d=%description"
32
- icon: mastodon-alt
33
- - title: Facebook
34
- url: "https://www.facebook.com/sharer/sharer.php?u=%url&t=%title%0A%0A%description"
35
- icon: facebook-official
36
59
  - title: Twitter
37
- url: "https://twitter.com/intent/tweet?url=%url&text=%title%0A%0A%description&hashtags=ContamosConVoz"
60
+ url: "https://twitter.com/intent/tweet?url=%url&amp;text=%title%0A%0A%description&amp;hashtags=%tags"
38
61
  icon: twitter
62
+ - title: Facebook
63
+ url: "https://www.facebook.com/sharer/sharer.php?u=%url&amp;t=%title%0A%0A%description"
64
+ icon: facebook-official
39
65
  - title: Whatsapp
40
66
  url: "https://api.whatsapp.com/send?text=%title%0A%0A%description%0A%0A%url"
41
67
  icon: whatsapp
42
68
  - title: Telegram
43
- url: "https://t.me/share/url?url=%url&text=%title%0A%0A%description"
69
+ url: "https://t.me/share/url?url=%url&amp;text=%title%0A%0A%description"
44
70
  icon: telegram
45
71
  - title: Tumblr
46
- url: "https://www.tumblr.com/widgets/share/tool?canonicalUrl=%url&title=%title&caption=%description&tags=ContamosConVoz"
72
+ url: "https://www.tumblr.com/widgets/share/tool?canonicalUrl=%url&amp;title=%title&amp;caption=%description&amp;tags=%tags"
47
73
  icon: tumblr
48
74
  - title: Reddit
49
- url: "https://reddit.com/submit?url=%url&title=ConVozContamos%20-%20%title"
75
+ url: "https://reddit.com/submit?url=%url&amp;title=%tags%20-%20%title"
50
76
  icon: reddit
51
77
  - title: Correo
52
- url: "mailto:?subject=%title&body=%description%0A%0A%url"
78
+ url: "mailto:?subject=%title&amp;body=%description%0A%0A%url"
53
79
  icon: envelope
80
+ - title: Fediverso
81
+ url: "https://fediverse.sutty.nl/es/?u=%url&amp;t=%title&amp;d=%description%20%tags"
82
+ icon: mastodon-alt
83
+ home:
84
+ campaign:
85
+ text: Creá tu campaña
86
+ url: https://sutty.nl/
87
+ print:
88
+ text: Imprimir
89
+ icon: print
90
+ form:
91
+ default: adhesion
92
+ title: Sumá tu adhesión
93
+ submit: Adherir
94
+ adhesion: Adherir como organización
95
+ adhesion_individual: Adherir como individue
96
+ submit_help: "Para prevenir el spam, por favor espera <span data-seconds>30</span> segundos antes de enviar."
97
+ adhesiones: Adhesiones de organizaciones
98
+ metric: firmas
99
+ share_post:
100
+ text: Compartir adhesión
101
+ icon: share-alt
102
+ footer: "Sitio hecho con [Sutty](https://sutty.nl/es/), diseño por [librenauta](https://copiona.com/) - creá tu campaña [aquí](https://sutty.nl/)"
@@ -47,8 +47,8 @@ consent:
47
47
  type: 'boolean'
48
48
  required: true
49
49
  label:
50
- es: 'Acepto las políticas de privacidad'
51
- en: 'I agree to the privacy policy'
50
+ es: 'Acepto las [políticas de privacidad](https://sutty.nl/politica-de-privacidad/)'
51
+ en: 'I agree to the [privacy policy](https://sutty.nl/en/privacy-policy/)'
52
52
  help:
53
53
  es: ''
54
54
  en: ''
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title:
3
3
  private: true
4
- type: 'number'
4
+ type: 'string'
5
5
  required: true
6
6
  label:
7
7
  es: 'Documento Nacional de Identidad'
@@ -0,0 +1,73 @@
1
+ ---
2
+ title:
3
+ type: 'string'
4
+ required: true
5
+ label:
6
+ en: ''
7
+ es: 'Nombre del ítem'
8
+ help:
9
+ en: ''
10
+ es: 'Tal como aparece en el menú'
11
+ post:
12
+ type: 'belongs_to'
13
+ label:
14
+ en: ''
15
+ es: 'Artículo'
16
+ help:
17
+ en: ''
18
+ es: 'Si el ítem lleva a un artículo fijo, asociarlo aquí'
19
+ item:
20
+ type: 'belongs_to'
21
+ inverse: items
22
+ filter:
23
+ layout: menu
24
+ label:
25
+ en: ''
26
+ es: 'Ítem anterior'
27
+ help:
28
+ en: ''
29
+ es: 'Si es un sub ítem, asociar el ítem superior aquí'
30
+ items:
31
+ type: 'has_many'
32
+ inverse: item
33
+ filter:
34
+ layout: menu
35
+ label:
36
+ en: ''
37
+ es: 'Sub ítemes'
38
+ help:
39
+ en: ''
40
+ es: 'Si el ítem tiene sub ítems, asociarlos aquí'
41
+ link:
42
+ type: 'string'
43
+ label:
44
+ en: ''
45
+ es: 'Vínculo'
46
+ help:
47
+ en: ''
48
+ es: 'Si el ítem lleva a una página o sección especial, asociarla aquí'
49
+ categories:
50
+ type: 'array'
51
+ label:
52
+ en: ''
53
+ es: 'Categorías'
54
+ help:
55
+ en: ''
56
+ es: 'Si el ítem lleva un sub menú de categorías, agregarlas aquí'
57
+ draft:
58
+ type: 'boolean'
59
+ label:
60
+ es: 'Borrador'
61
+ en: 'Draft'
62
+ help:
63
+ es: 'Este artículo aun no está listo para publicar'
64
+ en: "This post isn't ready to be published yet"
65
+ order:
66
+ type: 'order'
67
+ required: true
68
+ label:
69
+ es: 'Orden'
70
+ en: 'Order'
71
+ help:
72
+ es: 'La posición del artículo en la lista de artículos'
73
+ en: 'The post position in the posts list'
@@ -126,4 +126,3 @@ order:
126
126
  help:
127
127
  es: 'La posición del artículo en la lista de artículos'
128
128
  en: 'The post position in the posts list'
129
- ---
@@ -20,7 +20,7 @@
20
20
  {% endif %}
21
21
  class="form-check-input" />
22
22
 
23
- <label class="form-check-label" for="{{ id }}">{{ label }}</label>
23
+ <label class="form-check-label" for="{{ id }}">{{ label | markdownify }}</label>
24
24
 
25
25
  {%- if help -%}
26
26
  <small id="help-{{ id }}" class="form-text">
@@ -1,15 +1,18 @@
1
1
  {% comment %}
2
- Esta imagen obtiene una cookie desde la API de Sutty para autorizar el
3
- envío del formulario.
2
+ Esta imagen obtiene una cookie desde la API de Sutty para autorizar el
3
+ envío del formulario.
4
4
  {% endcomment %}
5
- <img class="d-none" src="https://api.sutty.nl/v1/sites/{{ site.hostname }}/contact/cookie.png" />
5
+ <img class="d-none invisible" src="https://api.sutty.nl/v1/sites/{{ site.hostname }}/contact/cookie.png" />
6
6
 
7
7
  {% comment %}
8
8
  El formulario se envía a la API. La definición del formulario se
9
9
  encuentra en _data/forms/contacto.yml
10
10
  {% endcomment %}
11
- <form action="https://api.sutty.nl/v1/sites/{{ site.hostname }}/contact/contacto"
12
- method="post">
11
+ <form
12
+ data-controller="contact"
13
+ data-delay="60"
14
+ action="https://api.sutty.nl/v1/sites/{{ site.hostname }}/contact/{{ include.name }}"
15
+ method="post">
13
16
  {%- for field in include.form -%}
14
17
  {% assign template = field[1].type | append: '.html' %}
15
18
  <div class="col{{ field[1].col | default: 12 | prepend: '-' }}">
@@ -0,0 +1,6 @@
1
+ <div
2
+ data-controller="floating-alert"
3
+ class="pointer-event-none floating-alert floating-alert-bottom d-flex justify-content-center w-100 position-fixed fade hide"
4
+ role="status" aria-live="polite" aria-atomic="true">
5
+ <div data-target="toast.content" class="floating-alert-content white background-black-t4"></div>
6
+ </div>
@@ -0,0 +1,38 @@
1
+ {%- comment -%}
2
+ El ítem tiene un dropdown si tiene sub ítems o si tiene categorías.
3
+ {%- endcomment -%}
4
+ {%- assign dropdown = include.item.items | present -%}
5
+ {%- unless dropdown -%}
6
+ {%- assign dropdown = include.item.categories | present -%}
7
+ {%- endunless -%}
8
+
9
+ <div class="nav-item w-100 w-lg-auto {{ dropdown | value_if: 'dropdown d-flex flex-wrap' }}">
10
+ {%- comment -%}
11
+ La URL del item puede ser:
12
+ * El artículo vinculado
13
+ * El vínculo escrito manualmente
14
+ * La primera categoría de la lista
15
+ * La dirección propia (en el caso de categorías)
16
+ {%- endcomment -%}
17
+ <a
18
+ href="{{ include.item.post.url | default: include.item.link | default: include.item.categories[0].url | default: include.item.url }}"
19
+ class="nav-link flex-grow-1 flex-grow-lg-0">
20
+ {{ include.item.title }}
21
+ </a>
22
+
23
+ {%- if dropdown -%}
24
+ <button class="dropdown-toggle border-0 background-white w-5 w-lg-auto pl-lg-3"></button>
25
+ <div class="dropdown-menu w-100 w-lg-auto flex-grow-1 flex-grow-lg-0">
26
+ {% for item in include.item.items %}
27
+ {%- include_cached item.html item=item -%}
28
+ {% endfor %}
29
+
30
+ {%- comment -%}
31
+ Esto necesita `replace` en sutty-archives
32
+ {%- endcomment -%}
33
+ {%- for item in include.item.categories offset: 1 -%}
34
+ {%- include_cached item.html item=item -%}
35
+ {%- endfor -%}
36
+ </div>
37
+ {%- endif -%}
38
+ </div>
@@ -0,0 +1,27 @@
1
+ {%- comment -%}
2
+ Empezamos con los ítems que no dependen de otros e implementamos
3
+ recursivamente.
4
+ {%- endcomment -%}
5
+ {%- assign items = site.posts | where: 'layout', 'menu' | where: 'item', nil -%}
6
+
7
+ <nav class="navbar navbar-expand-lg navbar-light">
8
+ <button class="navbar-toggler"
9
+ type="button"
10
+ data-toggle="collapse"
11
+ data-target="#menu"
12
+ aria-label="{{ site.i18n.menu.title }}">
13
+ <span class="navbar-toggler-icon"></span>
14
+ </button>
15
+
16
+ <div class="collapse navbar-collapse" id="menu">
17
+ <div class="navbar-nav w-100 d-flex align-items-start justify-content-center">
18
+ {% for item in items %}
19
+ {%- include_cached item.html item=item -%}
20
+ {% endfor %}
21
+
22
+ <div class="nav-item w-100 w-lg-auto">
23
+ {%- include_cached search.html -%}
24
+ </div>
25
+ </div>
26
+ </div>
27
+ </nav>
@@ -1,23 +1,31 @@
1
1
  <nav class="navbar navbar-expand-lg navbar-light bg-light d-print-block" role="navigation" aria-label="{{ site.i18n.menu.title }}">
2
2
  <a class="navbar-brand" href="">
3
- {% include_cached logo.html %}
3
+ {% include_cached logo.svg %}
4
4
  </a>
5
5
 
6
- {% comment %}
7
- TODO: Add CSS-only hamburger menu.
8
- {% endcomment %}
9
- <ul class="navbar-nav d-print-none">
6
+ <ul class="navbar-nav d-print-none" data-controller="menu">
10
7
  {%- for item in site.i18n.menu.items -%}
11
8
  {% comment %}
12
- This makes it hard to just cache the whole navbar, but we prefer
13
- to mark the active item in code rather than with JS.
9
+ Algunos items del menú tienen layouts para indicar que
10
+ queremos el primero de esos artículos independientemente de
11
+ la URL.
12
+
13
+ XXX: Como las asignaciones sobreviven a este archivo hay que
14
+ convertirlas a nil cuando se las deja de usar.
14
15
  {% endcomment %}
16
+ {%- if item.layout -%}
17
+ {%- assign post = site.posts | find: 'layout', item.layout -%}
18
+ {%- else -%}
19
+ {%- assign post = nil -%}
20
+ {%- endif -%}
15
21
 
22
+ {%- assign href = post.url | default: item.href -%}
23
+ {%- assign active = include.active_cache_key | equals: href -%}
16
24
  <li class="nav-item">
17
- <a class="nav-link{% if page.url == item.href %} active{% endif %}" href="{{ item.href }}">
25
+ <a data-target="menu.item" class="nav-link {{ active | ternary: 'active', '' }}" href="{{ href }}">
18
26
  {{ item.title }}
19
27
 
20
- {%- if page.url == item.href -%}
28
+ {%- if active -%}
21
29
  <span class="sr-only">
22
30
  {{ site.i18n.menu.active | default: '(current)' }}
23
31
  </span>
@@ -0,0 +1 @@
1
+ {% include input.html field=include.field form=include.form %}