Skip to content

Commit f445eb2

Browse files
committed
fix: more seo stuff v4
1 parent e8b7a29 commit f445eb2

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/hooks/useSeo.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { useEffect } from 'react';
2-
import { useLocation } from 'react-router-dom';
1+
import {useEffect} from 'react';
2+
import {useLocation} from 'react-router-dom';
33

44
const BASE_URL = 'https://fezcode.com';
55

66
/**
77
* useSeo - A simplified hook for managing site metadata.
88
* Standardizes Title, Description, and Image across all platforms (OG, Twitter, etc.)
99
*/
10-
function useSeo({ title, description, image, keywords, ogImage, twitterImage }) {
10+
function useSeo({title, description, image, keywords, ogImage, twitterImage}) {
1111
const location = useLocation();
1212

1313
useEffect(() => {
@@ -16,13 +16,14 @@ function useSeo({ title, description, image, keywords, ogImage, twitterImage })
1616

1717
// 2. Prepare standardized values
1818
const currentUrl = BASE_URL + location.pathname;
19-
19+
// Determine default image based on path
20+
const isAppPath = location.pathname.startsWith('/apps');
21+
const defaultImage = isAppPath ? '/images/asset/ogtitle-apps.png' : '/images/asset/ogtitle.png';
2022
// Pick the first available image, fallback to default
21-
const rawImage = image || ogImage || twitterImage || '/images/asset/ogtitle.png';
23+
const rawImage = image || ogImage || twitterImage || defaultImage;
2224
const finalImage = rawImage.startsWith('http')
2325
? rawImage
2426
: BASE_URL + (rawImage.startsWith('/') ? '' : '/') + rawImage;
25-
2627
// 3. Helper to update/create meta tags
2728
const setMeta = (attrName, attrValue, content) => {
2829
if (!content) return;

0 commit comments

Comments
 (0)