Cleaned up link code for projects and added git vs web links
All checks were successful
Docker Deploy / build-and-push (push) Successful in 5m7s

This commit is contained in:
2025-10-14 12:59:10 -06:00
parent 94146782cb
commit 0d474804ec
6 changed files with 76 additions and 56 deletions

View File

@@ -95,15 +95,29 @@ const { project } = Astro.props;
<div class="card-actions justify-center gap-2 mt-4">
{
project.link && (
project.webLink && (
<a
href={project.link}
href={project.webLink}
target="_blank"
rel="noopener noreferrer"
class="btn btn-sm gap-2 bg-accent-content text-accent hover:bg-accent-content/90"
aria-label={`Visit ${project.name}`}
aria-label={`Visit ${project.name} website`}
>
<Icon name="mdi:link" class="w-4 h-4" />
<Icon name="mdi:web" class="w-4 h-4" />
Website
</a>
)
}
{
project.gitLink && (
<a
href={project.gitLink}
target="_blank"
rel="noopener noreferrer"
class="btn btn-sm gap-2 bg-accent-content text-accent hover:bg-accent-content/90"
aria-label={`View ${project.name} source code`}
>
<Icon name="simple-icons:gitea" class="w-4 h-4" />
Source
</a>
)

View File

@@ -23,8 +23,12 @@ function isGiteaDomain(url: string): boolean {
const projectsWithGiteaInfo = await Promise.all(
config.projects.map(async (project) => {
if (project.link && !project.giteaInfo && isGiteaDomain(project.link)) {
const giteaInfo = await fetchGiteaInfoFromUrl(project.link);
if (
project.gitLink &&
!project.giteaInfo &&
isGiteaDomain(project.gitLink)
) {
const giteaInfo = await fetchGiteaInfoFromUrl(project.gitLink);
if (giteaInfo) {
return { ...project, giteaInfo } as Project;
}