Skip to content

Commit

Permalink
SEO fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhincore committed Jan 16, 2025
1 parent 4a4bd2d commit ba6cea4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ORIGIN="https://redmodding.org"
LIZZY_API_URL="https://backend.redmodding.org/"

LIZZY_API_TOKEN="" # Override in .env.local
PUBLIC_IMAGE_URL_PREFIX=""

DISCORD_SERVER_ID="717692382849663036"

ORIGIN="https://redmodding.org"
5 changes: 3 additions & 2 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ jobs:

- name: build
env:
BASE_PATH: "/${{ github.event.repository.name }}"
LIZZY_API_TOKEN: ${{ secrets.LIZZY_API_TOKEN }}
# BASE_PATH: "/${{ github.event.repository.name }}" # Not used because we have custom domain
ORIGIN: ${{ env.ORIGIN }}
PUBLIC_IMAGE_URL_PREFIX: ${{ env.PUBLIC_IMAGE_URL_PREFIX }}
run: pnpm build

- name: Upload Artifacts
Expand Down
10 changes: 8 additions & 2 deletions src/lib/components/parts/SEO.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
import { page } from "$app/state";
import screenshot from "$assets/screenshot.webp";
import { PUBLIC_IMAGE_URL_PREFIX } from "$env/static/public";
import { site } from "$lib/content/site";
interface Props {
Expand All @@ -25,10 +26,15 @@
.filter((v) => v)
.join("");
function mask(url: string) {
if (PUBLIC_IMAGE_URL_PREFIX) return PUBLIC_IMAGE_URL_PREFIX + url;
return url;
}
let titleBase = $derived(joinTitle(title));
let titleFull = $derived(joinTitle(title, site.name));
let url = $derived(page.url.origin + page.url.pathname);
let _image = $derived(image.startsWith("/") ? page.url.origin + image : image);
let _image = $derived(image.startsWith("/") ? page.url.origin + image : mask(image));
</script>

<svelte:head>
Expand All @@ -47,7 +53,7 @@
<meta name="twitter:title" content={titleBase} />
<meta name="twitter:description" content={description} />
<meta name="twitter:card" content={card} />
<meta name="twitter:image:src" content={_image} />
<meta name="twitter:image" content={_image} />

<meta name="theme-color" content={site.color} />
</svelte:head>
4 changes: 3 additions & 1 deletion svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ const config = {
preprocess: vitePreprocess(),

kit: {
adapter: adapter(),
adapter: adapter({
fallback: "404.html",
}),
prerender: {
origin: process.env.ORIGIN,
},
Expand Down

0 comments on commit ba6cea4

Please sign in to comment.