Skip to content

Commit

Permalink
fix: nuxt makes seo hard
Browse files Browse the repository at this point in the history
  • Loading branch information
Chalks committed Jan 25, 2024
1 parent 2db4b30 commit 414938e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ export default defineNuxtConfig({
runtimeConfig: {
public: {
authCookieName: 'auth',
origin: process.env.NODE_ENV === 'production'
? 'https://jdw.me'
: 'http://localhost:3000',
jwtApi: process.env.NODE_ENV === 'development'
? 'http://localhost:3001'
: 'https://seahorse-app-w4qv4.ondigitalocean.app',
Expand All @@ -79,7 +82,7 @@ export default defineNuxtConfig({

srcDir: 'src/',

ssr: false,
ssr: true,

telemetry: false,
});
6 changes: 4 additions & 2 deletions src/utils/seo.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ export default ({
imageHeight = 600,
type = 'website',
} = {}) => {
const url = `${window.location.origin}${window.location.pathname}`.replace(/\/$/, '');
const imageUrl = `${window.location.origin}${imagePath}`;
const route = useRoute();
const {origin} = useRuntimeConfig().public;
const url = `${origin}${route.path}`.replace(/\/$/, '');
const imageUrl = `${origin}${imagePath}`;

useHead({
meta: [
Expand Down

0 comments on commit 414938e

Please sign in to comment.