Skip to content

Commit

Permalink
Merge pull request #375 from rl404/develop
Browse files Browse the repository at this point in the history
fix: schema id string & url
  • Loading branch information
rl404 authored Jul 5, 2024
2 parents e99b280 + 7dfa187 commit a0f8d88
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/routes/(app)/agencies/[id]/[...name]/Schema.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { generateAgencyDescription } from '$lib/utils/utils';
import { generateAgencyDescription, toURL } from '$lib/utils/utils';
import type { Organization, WithContext } from 'schema-dts';
import type { AgencyResponseData } from '../../../../api/agencies/[id]/+server';
import type { VtuberResponseData } from '../../../../api/vtubers/[id]/+server';
Expand All @@ -12,7 +12,7 @@
$: schema = {
'@context': 'https://schema.org',
'@type': 'Organization',
url: `https://amatsukaze.rl404.com/agencies/${agency.id}/${agency.name}`,
url: `https://amatsukaze.rl404.com/agencies/${agency.id}/${toURL(agency.name)}`,
identifier: agency.id.toString(),
name: agency.name,
description: generateAgencyDescription(agency),
Expand All @@ -22,7 +22,7 @@
'@type': 'Person',
identifier: v.id.toString(),
name: v.name,
url: `https://amatsukaze.rl404.com/vtubers/${v.id}/${v.name}`
url: `https://amatsukaze.rl404.com/vtubers/${v.id}/${toURL(v.name)}`
}))
};
</script>
Expand Down
4 changes: 2 additions & 2 deletions src/routes/(app)/statistics/AgencyMostSubsChart.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import BarChart from '$lib/components/charts/BarChart.svelte';
import { getAxiosError } from '$lib/utils/api';
import { compactInt } from '$lib/utils/utils';
import { compactInt, toURL } from '$lib/utils/utils';
import axios from 'axios';
import { Spinner } from 'flowbite-svelte';
import { onMount } from 'svelte';
Expand All @@ -20,7 +20,7 @@
});
const onClick = (d: any) =>
window.open(`/agencies/${data[d.detail].id}/${data[d.detail].name}`, '_blank')?.focus();
window.open(`/agencies/${data[d.detail].id}/${toURL(data[d.detail].name)}`, '_blank')?.focus();
</script>

{#if loading}
Expand Down
3 changes: 2 additions & 1 deletion src/routes/(app)/statistics/VtuberCountByAgencyChart.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
import BarChart from '$lib/components/charts/BarChart.svelte';
import { getAxiosError } from '$lib/utils/api';
import { toURL } from '$lib/utils/utils';
import axios from 'axios';
import { Spinner } from 'flowbite-svelte';
import { onMount } from 'svelte';
Expand All @@ -21,7 +22,7 @@
});
const onClick = (d: any) =>
window.open(`/agencies/${data[d.detail].id}/${data[d.detail].name}`, '_blank')?.focus();
window.open(`/agencies/${data[d.detail].id}/${toURL(data[d.detail].name)}`, '_blank')?.focus();
</script>

{#if loading}
Expand Down
10 changes: 8 additions & 2 deletions src/routes/(app)/vtubers/[id]/[...name]/Details.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<script lang="ts">
import ChannelBadge from '$lib/components/badges/ChannelBadge.svelte';
import { channelSorter, formatBirthday, getHostname, isEmptyArray } from '$lib/utils/utils';
import {
channelSorter,
formatBirthday,
getHostname,
isEmptyArray,
toURL
} from '$lib/utils/utils';
import { Card, P } from 'flowbite-svelte';
import type { VtuberResponseData } from '../../../../api/vtubers/[id]/+server';
Expand Down Expand Up @@ -88,7 +94,7 @@
{:else}
{#each vtuber.agencies as agency}
<P>
<a href={`/agencies/${agency.id}/${agency.name}`} class="clickable underline">
<a href={`/agencies/${agency.id}/${toURL(agency.name)}`} class="clickable underline">
{agency.name}
</a>
</P>
Expand Down
19 changes: 10 additions & 9 deletions src/routes/(app)/vtubers/[id]/[...name]/Schema.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script lang="ts">
import { toURL } from '$lib/utils/utils';
import type { ProfilePage, WithContext } from 'schema-dts';
import type { VtubersResponse } from '../../../../api/vtubers/+server';
import type { VtuberResponseData } from '../../../../api/vtubers/[id]/+server';
Expand All @@ -13,10 +14,10 @@
'@context': 'https://schema.org',
'@type': 'ProfilePage',
mainEntity: {
'@id': `https://amatsukaze.rl404.com/vtubers/${vtuber.id}/${vtuber.name}`,
'@id': `https://amatsukaze.rl404.com/vtubers/${vtuber.id}/${toURL(vtuber.name)}`,
'@type': 'Person',
url: `https://amatsukaze.rl404.com/vtubers/${vtuber.id}/${vtuber.name}`,
identifier: vtuber.id,
url: `https://amatsukaze.rl404.com/vtubers/${vtuber.id}/${toURL(vtuber.name)}`,
identifier: vtuber.id.toString(),
name: vtuber.name,
alternateName: [...(vtuber.original_names || []), ...(vtuber.nicknames || [])],
description: vtuber.caption,
Expand All @@ -30,18 +31,18 @@
publishingPrinciples: vtuber.channels.map((c) => c.url),
affiliation: vtuber.agencies.map((a) => ({
'@type': 'Organization',
identifier: a.id,
identifier: a.id.toString(),
name: a.name,
url: `https://amatsukaze.rl404.com/agencies/${a.id}/${a.name}`
url: `https://amatsukaze.rl404.com/agencies/${a.id}/${toURL(a.name)}`
})),
colleague: agencies.reduce(
(res, curr) => [
...res,
...curr.data.map((d) => ({
'@type': 'Person',
identifier: d.id,
identifier: d.id.toString(),
name: d.name,
url: `https://amatsukaze.rl404.com/vtubers/${d.id}/${d.name}`
url: `https://amatsukaze.rl404.com/vtubers/${d.id}/${toURL(d.name)}`
}))
],
[] as any
Expand All @@ -53,9 +54,9 @@
.filter((f) => f.id !== vtuber.id)
.map((f) => ({
'@type': 'Person',
identifier: f.id,
identifier: f.id.toString(),
name: f.name,
url: `https://amatsukaze.rl404.com/vtubers/${f.id}/${f.name}`
url: `https://amatsukaze.rl404.com/vtubers/${f.id}/${toURL(f.name)}`
}))
],
[] as any
Expand Down

0 comments on commit a0f8d88

Please sign in to comment.