Compare commits
6 commits
296b036db1
...
32feffab2a
| Author | SHA1 | Date | |
|---|---|---|---|
| 32feffab2a | |||
| ea7cbb0543 | |||
| af92cf6700 | |||
| 349e5fbc71 | |||
| 2b071d35b4 | |||
| c7e72eb273 |
9 changed files with 96 additions and 18 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h1>{{ meta.sitename }}</h1>
|
<h1>{{ meta.sitename }}</h1>
|
||||||
<a href={{ "/" | locale_url }}><div class="header-banner" title="{{ "home" | i18n }}"></div></a>
|
<a href={{ "/" | locale_url_resolve }}><div class="header-banner" title="{{ "home" | i18n }}"></div></a>
|
||||||
<!--<div class="motd">
|
<!--<div class="motd">
|
||||||
<marquee behavior="scroll" direction="left">
|
<marquee behavior="scroll" direction="left">
|
||||||
<p>{{ meta.motd }}</p>
|
<p>{{ meta.motd }}</p>
|
||||||
|
|
|
||||||
30
en/blog/blog.11tydata.js
Normal file
30
en/blog/blog.11tydata.js
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
module.exports = {
|
||||||
|
eleventyComputed: {
|
||||||
|
// TODO: handle titles as slugs instead of filenames
|
||||||
|
permalink: (data) => {
|
||||||
|
// get the file path stem ie "/en/blog/2025/2025-10-18-my-post"
|
||||||
|
let stem = data.page.filePathStem;
|
||||||
|
|
||||||
|
// strip the leading /en/ prefix
|
||||||
|
if (stem.startsWith("/en/")) {
|
||||||
|
stem = stem.replace(/^\/en/, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
// for blog posts under /blog/[year]/[year-month-day]-blogpost
|
||||||
|
// extract the year and the blog post slug (remove date prefix)
|
||||||
|
const blogPostMatch = stem.match(/^\/blog\/(\d{4})\/\d{4}-\d{2}-\d{2}-(.+)$/);
|
||||||
|
if (blogPostMatch) {
|
||||||
|
const [, year, slug] = blogPostMatch;
|
||||||
|
return `/blog/${year}/${slug}/index.html`; // ie /blog/2025/my-post/index.html
|
||||||
|
}
|
||||||
|
|
||||||
|
// fallback for index or other pages under /blog
|
||||||
|
if (stem.endsWith("/index")) {
|
||||||
|
return `${stem}.html`; // ie /blog/index.html
|
||||||
|
}
|
||||||
|
|
||||||
|
// default for non-index, non-blog-post pages
|
||||||
|
return `${stem}/index.html`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -1,19 +1,21 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
lang: "en",
|
lang: "en",
|
||||||
permalink: data => {
|
permalink: (data) => {
|
||||||
// `data.page.filePathStem` is the input path without extension, starting with a leading slash
|
// data.page.filePathStem: e.g., "/en/index", "/en/blog/index", "/en/blog/test-post"
|
||||||
// e.g. "/en/index" or "/en/blog/test-post"
|
let stem = data.page.filePathStem;
|
||||||
const stem = data.page.filePathStem;
|
|
||||||
if (stem === "/en/index") {
|
// strip the leading /en/ prefix
|
||||||
// For /en/index.md → /index.html
|
|
||||||
return "/index.html";
|
|
||||||
}
|
|
||||||
if (stem.startsWith("/en/")) {
|
if (stem.startsWith("/en/")) {
|
||||||
// For /en/anything-else.md (including subfolders), remove only the first /en
|
stem = stem.replace(/^\/en/, "");
|
||||||
// e.g. /en/blog/test-post → /en/blog/test-post/index.html
|
|
||||||
return `${stem.replace(/^\/en/, "")}/index.html`;
|
|
||||||
}
|
}
|
||||||
// fallback: default 11ty behavior
|
|
||||||
return data.page.outputPath;
|
// handle index files: If ends with /index, just use stem + /index.html → e.g., /blog/index.html
|
||||||
|
// this avoids appending extra /index.html if already ending in /index
|
||||||
|
if (stem.endsWith("/index")) {
|
||||||
|
return `${stem}.html`; // /blog/index.html
|
||||||
|
}
|
||||||
|
|
||||||
|
// for non-index files: append /index.html for pretty URLs (e.g., /blog/test-post → /blog/test-post/index.html, URL /blog/test-post/)
|
||||||
|
return `${stem}/index.html`;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -11,4 +11,4 @@ welcome to my site!! as with every website this is a heavy work in progress. how
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
you can browser however you like in the meanwhile.
|
leave a comment in the [guestbook]({{ "/guestbook" | locale_url_resolve }}) in the meanwhile!!
|
||||||
|
|
|
||||||
35
es/blog/blog.11tydata.js
Normal file
35
es/blog/blog.11tydata.js
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
module.exports = {
|
||||||
|
eleventyComputed: {
|
||||||
|
// TODO: handle titles as slugs instead of filenames
|
||||||
|
permalink: (data) => {
|
||||||
|
// get the file path stem, e.g., "/es/blog/2025/2025-10-18-my-post"
|
||||||
|
let stem = data.page.filePathStem;
|
||||||
|
|
||||||
|
// extract the year from the path
|
||||||
|
const yearMatch = stem.match(/^\/es\/blog\/(\d{4})\//);
|
||||||
|
if (yearMatch) {
|
||||||
|
const year = yearMatch[1];
|
||||||
|
|
||||||
|
// check for slug_override first
|
||||||
|
if (data.slug_override) {
|
||||||
|
return `/es/blog/${year}/${data.slug_override}/index.html`; // ie /es/blog/2025/post-localizado/index.html
|
||||||
|
}
|
||||||
|
|
||||||
|
// handle blog posts with date prefix: /es/blog/[year]/[year-month-day]-slug
|
||||||
|
const blogPostMatch = stem.match(/^\/es\/blog\/(\d{4})\/\d{4}-\d{2}-\d{2}-(.+)$/);
|
||||||
|
if (blogPostMatch) {
|
||||||
|
const [, , slug] = blogPostMatch;
|
||||||
|
return `/es/blog/${year}/${this.slugify(slug)}/index.html`; // ie /es/blog/2025/my-post/index.html
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// handle index pages or other non-blog-post pages
|
||||||
|
if (stem.endsWith("/index")) {
|
||||||
|
return `${stem}.html`; // ie /es/blog/index.html
|
||||||
|
}
|
||||||
|
|
||||||
|
// default for other pages under /es/blog/
|
||||||
|
return `${stem}/index.html`; // ie /es/other-page/index.html
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -1,8 +1,19 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
lang: 'es',
|
lang: 'es',
|
||||||
permalink: function (data) {
|
permalink: function (data) {
|
||||||
|
let stem = data.page.filePathStem;
|
||||||
|
|
||||||
|
// handle slug_override
|
||||||
if (data.slug_override) {
|
if (data.slug_override) {
|
||||||
return `/${data.lang}/${this.slugify(data.slug_override)}/`;
|
return `/${data.lang}/${this.slugify(data.slug_override)}/`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// handle index pages
|
||||||
|
if (stem.endsWith("/index")) {
|
||||||
|
return `${stem}.html`; // e.g., /es/index.html
|
||||||
|
}
|
||||||
|
|
||||||
|
// default for other pages
|
||||||
|
return `${stem}/index.html`; // e.g., /es/about/index.html
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -11,4 +11,4 @@ bienvenid@ a mi sitio!! aún no lo termino <3 pienso terminar primero:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
por mientras siéntete en casa y revisa lo que quieras.
|
por mientras siéntete en casa y deja algún comentario en el [libro de visitas]({{ "/guestbook" | locale_url_resolve }})!!
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue