<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Rust on LinuxmanR4</title><link>https://linuxmanr4.com/tags/rust/</link><description>Recent content in Rust on LinuxmanR4</description><generator>Hugo -- gohugo.io</generator><language>es</language><copyright>LinuxmanR4</copyright><lastBuildDate>Thu, 18 Dec 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://linuxmanr4.com/tags/rust/index.xml" rel="self" type="application/rss+xml"/><item><title>Encontrando enlaces rotos en el blog con Lychee</title><link>https://linuxmanr4.com/p/enlaces-rotos-lychee/</link><pubDate>Wed, 17 Dec 2025 00:00:00 +0000</pubDate><guid>https://linuxmanr4.com/p/enlaces-rotos-lychee/</guid><description>&lt;img src="https://linuxmanr4.com/p/enlaces-rotos-lychee/enlaces-rotos-og.webp" alt="Featured image of post Encontrando enlaces rotos en el blog con Lychee" />&lt;p>Poco a poco me he acostumbrado al flujo de trabajo de Hugo. Podrán ver algunas
mejoras, por ejemplo, acabo de instalar &lt;a class="link" href="https://giscus.app/es" target="_blank" rel="noopener"
>giscus&lt;/a>
&lt;span style="white-space: nowrap;">&lt;svg width=".7em"
height=".7em" viewBox="0 0 21 21" xmlns="http://www.w3.org/2000/svg">
&lt;path d="m13 3l3.293 3.293l-7 7l1.414 1.414l7-7L21 11V3z" fill="currentColor" />
&lt;path d="M19 19H5V5h7l-2-2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2h14c1.103 0 2-.897 2-2v-5l-2-2v7z"
fill="currentColor">
&lt;/svg>&lt;/span>
como
sistema de comentarios. Eso fue sencillo, el &lt;em>theme&lt;/em> tiene muchas opciones para
eso.&lt;/p>
&lt;p>Pero para detectar enlaces rotos ¡Ahhhhhh! esa es otra historia.&lt;/p>
&lt;p>Con WordPress lo más sencillo era buscar algún plugin que hiciera la tarea para
luego ir corrigiendo los enlaces que con el tiempo han dejado de funcionar.&lt;/p>
&lt;p>Pero esto es Hugo y los &lt;em>plugins&lt;/em> ya no son una opción.&lt;/p>
&lt;h2 id="lychee-es-veloz">Lychee es veloz
&lt;/h2>&lt;p>Después de investigar cuales serían mis opciones di con un programita peculiar.&lt;/p>
&lt;p>&lt;a class="link" href="https://github.com/lycheeverse/lychee" target="_blank" rel="noopener"
>Lychee&lt;/a>
&lt;span style="white-space: nowrap;">&lt;svg width=".7em"
height=".7em" viewBox="0 0 21 21" xmlns="http://www.w3.org/2000/svg">
&lt;path d="m13 3l3.293 3.293l-7 7l1.414 1.414l7-7L21 11V3z" fill="currentColor" />
&lt;path d="M19 19H5V5h7l-2-2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2h14c1.103 0 2-.897 2-2v-5l-2-2v7z"
fill="currentColor">
&lt;/svg>&lt;/span>
esta basado en &lt;a class="link" href="https://rust-lang.org/es/" target="_blank" rel="noopener"
>Rust&lt;/a>
&lt;span style="white-space: nowrap;">&lt;svg width=".7em"
height=".7em" viewBox="0 0 21 21" xmlns="http://www.w3.org/2000/svg">
&lt;path d="m13 3l3.293 3.293l-7 7l1.414 1.414l7-7L21 11V3z" fill="currentColor" />
&lt;path d="M19 19H5V5h7l-2-2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2h14c1.103 0 2-.897 2-2v-5l-2-2v7z"
fill="currentColor">
&lt;/svg>&lt;/span>
y es realmente veloz, como un rayo 🌩 (imáginese la escena de pixar por favor, si ya sabe cual).&lt;/p>
&lt;p>Lychee encuentra enlaces rotos y direcciones de correo electrónico dentro de Markdown, HTML, reStructuredText o cualquier otro archivo de texto o sitio web.&lt;/p>
&lt;p>Con esta gran herramienta a la mano, solo necesitaba automatizar un poco la tarea.&lt;/p>
&lt;h2 id="empezamos-generando-el-sitio-web">Empezamos generando el sitio web
&lt;/h2>&lt;p>Es lo más sencillo, ejecutar el comando que genera el sitio web en la carpeta
&lt;em>public&lt;/em>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-fallback" data-lang="fallback">&lt;span class="line">&lt;span class="cl">hugo
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Si se completa exitosamente este comando (siempre puede haber errores) pasamos
a la siguiente etapa.&lt;/p>
&lt;h2 id="buscar-los-enlaces-rotos-con-lychee">Buscar los enlaces rotos con lychee
&lt;/h2>&lt;p>Pues ya tenemos nuestro sitio web estático generado en la carpeta &lt;em>public&lt;/em>.&lt;/p>
&lt;p>Ahora a buscar los enlaces rotos solamente en los archivos con extensión &lt;em>html&lt;/em>.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-fallback" data-lang="fallback">&lt;span class="line">&lt;span class="cl">lychee public --include &amp;#34;.html&amp;#34; --format json --root-dir / --output enlaces_rotos.json
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;img src="https://linuxmanr4.com/p/enlaces-rotos-lychee/lychee-buscando-enlaces-rotos.webp"
width="860"
height="634"
srcset="https://linuxmanr4.com/p/enlaces-rotos-lychee/lychee-buscando-enlaces-rotos_hu_43f0dfa82d0b2a9c.webp 480w, https://linuxmanr4.com/p/enlaces-rotos-lychee/lychee-buscando-enlaces-rotos_hu_5abbad9af5c322f7.webp 1024w"
loading="lazy"
alt="Buscando esos enlaces que han dejado de funcionar"
class="gallery-image"
data-flex-grow="135"
data-flex-basis="325px"
>&lt;/p>
&lt;p>Y como pueden ver guardamos los resultados en el archivo &lt;strong>enlaces_rotos.json&lt;/strong>&lt;/p>
&lt;p>Pero el resultado no es muy amigable que digamos, por eso agregamos un paso más.&lt;/p>
&lt;h2 id="generar-un-archivo-csv-con-los-resultados">Generar un archivo CSV con los resultados
&lt;/h2>&lt;p>Para encontrar la aguja en el pajar y hacer todo más manejable decidí generar
un archivo CSV que puedo abrir sin problemas en cualquier programa de hoja de
cálculo.&lt;/p>
&lt;p>Para hacerlo me ayudó el programa &lt;a class="link" href="https://jqlang.org/" target="_blank" rel="noopener"
>jq&lt;/a>
&lt;span style="white-space: nowrap;">&lt;svg width=".7em"
height=".7em" viewBox="0 0 21 21" xmlns="http://www.w3.org/2000/svg">
&lt;path d="m13 3l3.293 3.293l-7 7l1.414 1.414l7-7L21 11V3z" fill="currentColor" />
&lt;path d="M19 19H5V5h7l-2-2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2h14c1.103 0 2-.897 2-2v-5l-2-2v7z"
fill="currentColor">
&lt;/svg>&lt;/span>
que es especialista
en obtener información de archivos &lt;a class="link" href="https://www.json.org/json-es.html" target="_blank" rel="noopener"
>JSON&lt;/a>
&lt;span style="white-space: nowrap;">&lt;svg width=".7em"
height=".7em" viewBox="0 0 21 21" xmlns="http://www.w3.org/2000/svg">
&lt;path d="m13 3l3.293 3.293l-7 7l1.414 1.414l7-7L21 11V3z" fill="currentColor" />
&lt;path d="M19 19H5V5h7l-2-2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2h14c1.103 0 2-.897 2-2v-5l-2-2v7z"
fill="currentColor">
&lt;/svg>&lt;/span>
.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-fallback" data-lang="fallback">&lt;span class="line">&lt;span class="cl">jq -r &amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">.error_map
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">| to_entries[]
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">| .key as $source
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">| .value[]
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">| select(.url | startswith(&amp;#34;http&amp;#34;))
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">| &amp;#34;\($source) | \(.url) | \(.status.text)&amp;#34;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&amp;#39; enlaces_rotos.json &amp;gt; enlaces-rotos-externos.csv
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;img src="https://linuxmanr4.com/p/enlaces-rotos-lychee/enlaces-rotos-externos.webp"
width="1138"
height="722"
srcset="https://linuxmanr4.com/p/enlaces-rotos-lychee/enlaces-rotos-externos_hu_17606cf8ae2e3601.webp 480w, https://linuxmanr4.com/p/enlaces-rotos-lychee/enlaces-rotos-externos_hu_9a7b5577e739702b.webp 1024w"
loading="lazy"
alt="Revisando los enlaces rotos externos del blog"
class="gallery-image"
data-flex-grow="157"
data-flex-basis="378px"
>&lt;/p>
&lt;p>Algunos no están realmente rotos, pero con el tiempo aprendes a ignorar los errores
comunes para centrarte en los que realmente necesitan mi atención.&lt;/p>
&lt;p>Lo más probable es que haga un archivo bash que ejecute todo esto regularmente.&lt;/p>
&lt;p>¿Ustedes como enfrentan este problema? ¿Qué herramientas utilizan?&lt;/p>
&lt;blockquote>
&lt;p>&amp;ldquo;Conócete a ti mismo.&amp;rdquo;&lt;/p>&lt;span class="cite">&lt;span>― &lt;/span>&lt;span>Sócrates&lt;/span>&lt;cite>&lt;/cite>&lt;/span>&lt;/blockquote></description></item></channel></rss>