Skip to content

Commit

Permalink
feat: 💄 add link colors
Browse files Browse the repository at this point in the history
  • Loading branch information
neptunes5thmoon committed Jun 27, 2024
1 parent dc73590 commit 972eb7a
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,25 @@ <h1 class="post-title">{{ page.title }}</h1>
margin-left:30%;
padding-top: 10px;
}
/* Link colors */
.main a.internal-link {
color: #6d7fae; /* Normal state */
text-decoration: none; /* No underline */
font-style: italic;
}
.main a.external-link {
color: #007bff; /* Normal state */
text-decoration: none; /* No underline */
}

.main a:hover {
color: #0056b3; /* Hover state */
text-decoration: underline; /* Underline on hover */
}

.main a:active {
color: #003d7a; /* Active state */
}
</style>

<div>
Expand Down Expand Up @@ -94,4 +113,13 @@ <h3>Table of Contents</h3>
});
});
});
// Add classes to differentiate internal and external links
var allLinks = document.querySelectorAll('.main a');
allLinks.forEach(function(link) {
if (link.hostname !== window.location.hostname) {
link.classList.add('external-link');
} else {
link.classList.add('internal-link');
}
});
</script>

0 comments on commit 972eb7a

Please sign in to comment.