Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure sitemap #38

Merged
merged 4 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .env.local.sample
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# development | staging | production
NODE_ENV=development

# This application's URL - used for sitemaps.
FRONTEND_URL=http://localhost:3000

# Your WordPress site URL
NEXT_PUBLIC_WORDPRESS_URL=https://bpacfwpgraphql.wpengine.com

# Plugin secret found in WordPress Settings->Headless
# FAUST_SECRET_KEY=YOUR_PLUGIN_SECRET
# FAUST_SECRET_KEY=YOUR_PLUGIN_SECRET

# Enable debug mode in Faust.
# FAUST_DEBUG=false
5 changes: 1 addition & 4 deletions pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import '@/faust.config'
import { WordPressBlocksProvider } from '@faustwp/blocks'
import { FaustProvider } from '@faustwp/core'
import Head from 'next/head'
import { useRouter } from 'next/router'
import React from 'react'

import 'focus-visible'
Expand All @@ -12,9 +11,7 @@ import { SearchProvider } from '@/components/Search'
import { ThemeProvider } from '@/components/ThemeProvider'
import blocks from '@/wp-blocks'

export default function MyApp({ Component, pageProps }) {
const router = useRouter()

export default function MyApp({ Component, pageProps, router }) {
return (
<ThemeProvider
attribute="class"
Expand Down
10 changes: 10 additions & 0 deletions pages/sitemap.xml.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { getSitemapProps } from '@faustwp/core';

export default function Sitemap() {}

export function getServerSideProps(ctx) {
return getSitemapProps(ctx, {
frontendUrl: process.env.FRONTEND_URL,
sitemapPathsToIgnore: ['/wp-sitemap-users-*'],
});
}