Add support for link preview.

This commit is contained in:
天クマ 2026-04-20 15:41:51 -03:00
commit e932940df7
3 changed files with 15 additions and 3 deletions

View file

@ -16,6 +16,11 @@ eleventyConfig.addNunjucksFilter("alternateLanguages", function(collection, post
}))
});
eleventyConfig.addFilter("absoluteUrl", function(path) {
const base = "https://adrianvic.github.io";
return base + path;
});
eleventyConfig.addNunjucksFilter("smartTitle", function(str) {
if (!str) return "";
const smallWords = ["a","an","and","at","but","by","for","in","nor","of","on","or","so","the","to","up","yet",

View file

@ -55,7 +55,8 @@ module.exports = {
back: "back",
hideBackground: "Hide background",
options: "Options",
alsoAvailableAsVideo: "Also available as video"
alsoAvailableAsVideo: "Also available as video",
websiteDescription: "Personal website/blog of Adrian Victor."
},
pt: {
language: "português",
@ -98,6 +99,7 @@ module.exports = {
back: "voltar",
hideBackground: "Esconder imagem de fundo",
options: "Opções",
alsoAvailableAsVideo: "Também disponível em vídeo"
alsoAvailableAsVideo: "Também disponível em vídeo",
websiteDescription: "Website/blog pessoal de Adrian Victor."
}
};

View file

@ -12,6 +12,11 @@
<link rel="icon" type="image/png" sizes="16x16" href="/static/favicon-16x16.png">
<link rel="manifest" href="/static/site.webmanifest">
<script src="https://keepandroidopen.org/banner.js" defer></script>
<meta property="og:title" content="Adrian Victor{% if pageTitle or postTitle %} - {{ pageTitle or postTitle }}{% endif %}">
<meta property="og:description" content="{{ description or i18n[langKey].websiteDescription }}">
<meta property="og:type" content="article">
<meta property="og:url" content="{{ page.url | url | absoluteUrl }}">
<meta property="og:image" content="{{ ('/static/images/' ~ (background or 'bear.jpg')) | absoluteUrl }}">
</head>
<body>
<style>
@ -20,7 +25,7 @@
}
</style>
<div id="everythingHelper">
<img src="/static/images/{{ background or "bear.jpg" }}" class="bg">
<img src="/static/images/{{ background or "bear.jpg" }}" class="bg">
{% include "header.njk" %}
<div id="mainHelper">
{{ content | safe }}