Permalink
Please sign in to comment.
Browse files
Language links refactor (programminghistorian#818)
* use snippets for author info heading * refactor translation<>original links using where_exp * for citation use translation_date rather than trying to check language * use direct paths to spanish lessons rather than redirects * bundle update * add "original" metadata to all translated lessons * Functioning page-to-page translation links Refactors the generation of translation links so that, for any page that points to an "original" source language, we can identify its translations and generate the proper links in the menu header * add "original" links for existing spanish lessons * only create twitter cards for lessons and posts * Create autogenerated translation concordance Useful for debugging * Describe how to use `original` YAML tag in ES editorial guide * Document how the new translation links work. * render translation concordance as table * add translation concordance to about menu * enforce "original" links on spanish lessons This does mean that lessons submitted originally in Spanish will need to use the "exclude_from_check" tag.
- Loading branch information...
Showing
with
220 additions
and 118 deletions.
- +32 −32 Gemfile.lock
- +4 −0 _config.yml
- +26 −4 _data/snippets.yml
- +1 −6 _includes/author-info.html
- +2 −3 _includes/figure.html
- +2 −0 _includes/header.html
- +0 −29 _includes/lesson-slug.html
- +8 −11 _includes/lesson_describe.html
- +29 −3 _includes/menu.html
- +12 −0 _includes/page-slug.html
- +14 −0 _includes/translation-links.html
- +2 −0 _layouts/base.html
- +0 −1 _layouts/blank.html
- +16 −27 _layouts/lesson.html
- +1 −1 _plugins/validate_yaml.rb
- +1 −0 es/acerca-de.md
- +1 −0 es/contribuciones.md
- +1 −0 es/equipo-de-proyecto.md
- +2 −1 es/guia-editor.md
- +1 −0 es/guia-para-autores.md
- +1 −0 es/guia-para-revisores.md
- +1 −0 es/index.md
- +1 −0 es/investigacion.md
- +1 −0 es/lecciones.md
- +1 −0 es/lecciones/contar-frecuencias.md
- +1 −0 es/lecciones/creando-diagramas-de-redes-desde-fuentes-historicas.md
- +1 −0 es/lecciones/crear-y-ver-archivos-html-con-python.md
- +1 −0 es/lecciones/de-html-a-lista-de-palabras-1.md
- +1 −0 es/lecciones/de-html-a-lista-de-palabras-2.md
- +1 −0 es/lecciones/editar-audio-con-audacity.md
- +1 −0 es/lecciones/escritura-sostenible-usando-pandoc-y-markdown.md
- +1 −0 es/lecciones/instalacion-linux.md
- +1 −0 es/lecciones/instalacion-mac.md
- +1 −0 es/lecciones/instalacion-windows.md
- +1 −0 es/lecciones/instalar-modulos-python-pip.md
- +1 −0 es/lecciones/intro-a-google-maps-y-google-earth.md
- +1 −0 es/lecciones/introduccion-a-bash.md
- +1 −0 es/lecciones/introduccion-a-markdown.md
- +1 −0 es/lecciones/introduccion-control-versiones-github-desktop.md
- +1 −0 es/lecciones/introduccion-e-instalacion.md
- +1 −0 es/lecciones/limpieza-de-datos-con-OpenRefine.md
- +1 −0 es/lecciones/manipular-cadenas-de-caracteres-en-python.md
- +1 −0 es/lecciones/mineria-de-datos-en-internet-archive.md
- +1 −0 es/lecciones/normalizar-datos.md
- +1 −0 es/lecciones/palabras-clave-en-contexto-n-grams.md
- +1 −0 es/lecciones/poniendo-omeka-a-funcionar.md
- +1 −0 es/lecciones/preservar-datos-de-investigacion.md
- +1 −0 es/lecciones/reutilizacion-de-codigo-y-modularidad.md
- +1 −0 es/lecciones/salida-de-datos-como-archivo-html.md
- +1 −0 es/lecciones/salida-palabras-clave-contexto-ngrams.md
- +1 −0 es/lecciones/sparql-datos-abiertos-enlazados.md
- +1 −0 es/lecciones/trabajar-con-archivos-de-texto.md
- +1 −0 es/lecciones/trabajar-con-paginas-web.md
- +1 −0 es/lecciones/ver-archivos-html.md
- +1 −0 es/politica-retirada-lecciones.md
- +1 −0 es/retroalimentacion.md
- +29 −0 translation-concordance.md
@@ -0,0 +1,12 @@ | |||
{% comment %} | |||
|
|||
Calculates canonical page slug used for referencing subdirectories in the /assets/images and /gallery directories. If the page is translated, then the canonical slug belongs to the original lesson; if not, then the canonical slug is taken from the page url alone. | |||
|
|||
{% endcomment %} | |||
|
|||
{% assign slug = page.url | split: "/" | last | remove_first: ".html" %} | |||
{% if page.original %} | |||
{% assign canonical_slug = page.original %} | |||
{% else %} | |||
{% assign canonical_slug = slug %} | |||
{% endif %} |
@@ -0,0 +1,14 @@ | |||
{% comment %} | |||
Attached to all pages, this include will check two things: | |||
|
|||
1. First, if there are any translations of this page elsewhere on the site. Those 0+ page objects are saved to the variable `translation_candidates` available when rendering the rest of the page. | |||
|
|||
2. IF this page is known to be a translation of another page because its YAML contains an `original` tag, then the second section of this workflow searches across the site to find the 1 matching page that is the `translation_source` | |||
{% endcomment %} | |||
|
|||
{% include page-slug.html %} | |||
|
|||
{% assign translation_candidates = site.pages | where_exp: "item", "item.original contains slug" | where_exp: "item", "item.url != page.url" %} | |||
|
|||
{% assign target_slug = page.original %} | |||
{% assign translation_source = site.pages | where_exp: "item", "item.url contains target_slug" | where_exp: "item", "item.url != page.url" | where_exp: "item", "item.name != 'redirect.html'" %} |
Oops, something went wrong.
0 comments on commit
5329dca