Skip to content

Commit

Permalink
fix: canonical links
Browse files Browse the repository at this point in the history
  • Loading branch information
MiniDigger committed Jul 20, 2024
1 parent d826728 commit 8a9496b
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/projects/ProjectNavItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const props = defineProps<{
const route = useRoute();
const selected = computed(() => {
const routerPath = route.fullPath.endsWith("/") ? route.fullPath.substr(0, route.fullPath.length - 1) : route.fullPath;
const routerPath = route.path.endsWith("/") ? route.path.substr(0, route.path.length - 1) : route.path;
return routerPath === props.to;
});
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/composables/useOpenProjectPages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function useOpenProjectPages(route: RouteLocationNormalizedLoadedTyped<_R
watch(
route,
() => {
const slugs = route.fullPath.split("/").slice(4);
const slugs = route.path.split("/").slice(4);
if (slugs.length) {
for (let i = 0; i < slugs.length; i++) {
const slug = slugs.slice(0, i + 1).join("/");
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/composables/useSeo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function useSeo(
): UseHeadInput {
description = description || "Plugin repository for Paper, Velocity, Waterfall and Folia.";
const config = useConfig();
const canonical = config.publicHost + (route.fullPath.endsWith("/") ? route.fullPath.substring(0, route.fullPath.length - 1) : route.fullPath);
const canonical = config.publicHost + (route.path.endsWith("/") ? route.path.substring(0, route.path.length - 1) : route.path);
image = image || "https://docs.papermc.io/img/paper.png";
image = image.startsWith("http") ? image : config.publicHost + image;
if (!manualTitle) {
Expand Down Expand Up @@ -119,7 +119,7 @@ export function useSeo(

function generateBreadcrumbs(route: RouteLocationNormalized) {
const arr = [];
const split = route.fullPath.split("/");
const split = route.path.split("/");
let curr = "";
const config = useConfig();
for (let i = 0; i < split.length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/[user]/[project]/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ useHead(
name: props.project?.name,
datePublished: props.project?.createdAt,
dateCreated: props.project?.createdAt,
url: config.publicHost + route.fullPath,
url: config.publicHost + route.path,
}),
key: "project",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ useHead(
datePublished: projectVersion.value?.createdAt,
dateCreated: projectVersion.value?.createdAt,
version: projectVersion.value?.name,
url: config.publicHost + route.fullPath,
url: config.publicHost + route.path,
}),
key: "version",
},
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/[user]/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ useHead(
mainEntity: {
"@type": "Person",
name: props.user.name,
url: config.publicHost + "/" + route.fullPath,
url: config.publicHost + "/" + route.path,
description: props.user.tagline,
image: props.user.avatarUrl,
interactionStatistic: [
Expand Down

0 comments on commit 8a9496b

Please sign in to comment.