Skip to content

Commit

Permalink
add sitemap
Browse files Browse the repository at this point in the history
  • Loading branch information
ShrJamal committed Mar 25, 2024
1 parent 2eb9ef7 commit c48447e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const AppConfig = {
site: import.meta.env.SITE,
site: 'https://shrjamal.github.io/2048-3x3',
site_name: '2048.club',
title: '2048 3x3',
description: 'Play 2048 3x3 Game online for free and record your best score',
Expand Down
2 changes: 2 additions & 0 deletions src/pages/robots.txt.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import type { APIRoute } from 'astro'
import { AppConfig } from '~/app'

export const GET: APIRoute = async () => {
return new Response(
`
User-agent: *
Allow: /
Sitemap: ${AppConfig.site}/sitemap.xml
`,
{
headers: {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/sitemap.xml.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { APIRoute } from 'astro'
import { AppConfig } from '~/app'

const SITE = 'https://shrjamal.github.io/2048-3x3'
export const GET: APIRoute = async () => {
return new Response(
`<?xml version="1.0" encoding="UTF-8"?>
Expand Down Expand Up @@ -29,7 +29,7 @@ function getXMLEntry({
}) {
return `
<url>
<loc>${SITE}${path}</loc>
<loc>${AppConfig.site}${path}</loc>
${lastmod ? `<lastmod>${new Date(lastmod).toISOString()}</lastmod>` : ''}
${changeFreq ? `<changefreq>${changeFreq}</changefreq>` : ''}
${priority ? `<priority>${priority}</priority>` : ''}
Expand Down

0 comments on commit c48447e

Please sign in to comment.