Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/helpers/meta_tags.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import type { ProjectName } from "@/globals";
import { projectDataBySlug } from "@/data/projects";

const baseUrl = __SITE_URL__;

const jsonLdScriptsPerson = {
type: "application/ld+json",
innerHTML: JSON.stringify({
"@context": "https://schema.org",
"@type": "Person",
name: "Victor Trofin",
jobTitle: "Web Engineer",
url: "https://trofin.me",
url: baseUrl,
sameAs: ["https://github.com/vtrofin"],
}),
};

const homePageOgData = [
{ property: "og:url", content: "https://trofin.me" },
{ property: "og:url", content: baseUrl },
{ property: "og:type", content: "website" },
{ property: "og:image", content: "https://trofin.me/og_image.jpg" },
{ property: "og:image", content: `${baseUrl}/og_image.jpg` },
];

const metaTags = {
Expand Down Expand Up @@ -84,7 +86,7 @@ const metaTags = {
const metaTitle = `Victor Trofin — ${projectData.title} project`;
const metaDescription = `Full-stack web engineer for ${projectData.title} - ${projectData.excerpt}`;
const metaKeywords = techStack.trim().substring(0, 160);
const url = `https://trofin.me/projects/${slug}`;
const url = `${baseUrl}/projects/${slug}`;

return {
title: metaTitle,
Expand All @@ -98,7 +100,7 @@ const metaTags = {
{ property: "og:description", content: metaDescription },
{ property: "og:url", content: url },
{ property: "og:type", content: "website" },
{ property: "og:image", content: "https://trofin.me/og_image.jpg" },
{ property: "og:image", content: `${baseUrl}/og_image.jpg` },
],
script: [
{
Expand All @@ -112,7 +114,7 @@ const metaTags = {
author: {
"@type": "Person",
name: "Victor Trofin",
url: "https://trofin.me",
url: baseUrl,
},
}),
},
Expand Down
2 changes: 2 additions & 0 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/// <reference types="vite/client" />

declare const __SITE_URL__: string;
10 changes: 10 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,19 @@ import tsconfigPaths from "vite-tsconfig-paths";
import { allProjects } from "./src/globals";
import { type RouteRecordRaw } from "vue-router";

const siteUrl =
process.env.VERCEL_PROJECT_PRODUCTION_URL
? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
: process.env.VERCEL_URL
? `https://${process.env.VERCEL_URL}`
: `https://${process.env.VITE_APP_DOMAIN || "localhost:3000"}`;

// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue(), tsconfigPaths({ loose: true })],
define: {
__SITE_URL__: JSON.stringify(siteUrl),
},
resolve: {
extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue"],
},
Expand Down