Add styling to unresolved links

This commit is contained in:
Ole Eskild Steensen 2022-05-24 10:39:36 +02:00
parent c9d68e2d0f
commit a12c3b3e0a
2 changed files with 7 additions and 3 deletions

View File

@ -127,6 +127,7 @@ module.exports = function(eleventyConfig) {
let permalink = `/notes/${slugify(fileName)}`;
const title = linkTitle ? linkTitle : fileName;
let deadLink = false;
try {
@ -136,10 +137,10 @@ module.exports = function(eleventyConfig) {
permalink = frontMatter.data.permalink;
}
} catch {
//Ignore if file doesn't exist
deadLink = true;
}
return `<a class="internal-link" href="${permalink}${headerLinkPath}">${title}</a>`;
return `<a class="internal-link ${deadLink?'is-unresolved':''}" href="${permalink}${headerLinkPath}">${title}</a>`;
});
})

View File

@ -39,6 +39,9 @@ h4 {
font-family: 'Roboto', sans-serif;
}
a.is-unresolved{
color: rgb(97 186 245 / 65%);
}
a {
text-decoration: underline;
color: rgb(97, 186, 245);
@ -73,4 +76,4 @@ p>code {
//Inline code
color: #c7254e;
background-color: #1a1a1a;
}
}