This is an automated email from the ASF dual-hosted git repository. xiangfu pushed a commit to branch new-site-dev in repository https://gitbox.apache.org/repos/asf/pinot-site.git
The following commit(s) were added to refs/heads/new-site-dev by this push: new 6e5b8c3d add trailingSlash in next config to handle the trailing slash in the url (#130) 6e5b8c3d is described below commit 6e5b8c3ddcf69d737327ddf9d03cebe4b90345eb Author: Gio <153032991+gio-start...@users.noreply.github.com> AuthorDate: Mon Aug 19 23:31:31 2024 +0200 add trailingSlash in next config to handle the trailing slash in the url (#130) --- app/lib/contentlayer.utils.ts | 4 +-- next.config.js | 63 ++----------------------------------------- 2 files changed, 4 insertions(+), 63 deletions(-) diff --git a/app/lib/contentlayer.utils.ts b/app/lib/contentlayer.utils.ts index 25309edc..0eed97d2 100644 --- a/app/lib/contentlayer.utils.ts +++ b/app/lib/contentlayer.utils.ts @@ -15,7 +15,7 @@ const generateStandardSlug = (doc: LocalDocument) => { return slug; }; -const geenrateStandardPath = (doc: LocalDocument) => { +const generateStandardPath = (doc: LocalDocument) => { return doc._raw.flattenedPath; }; @@ -28,4 +28,4 @@ const generateCustomPath = (doc: LocalDocument) => { return path; }; -export { generateCustomSlug, generateStandardSlug, geenrateStandardPath, generateCustomPath }; +export { generateCustomSlug, generateStandardSlug, generateStandardPath, generateCustomPath }; diff --git a/next.config.js b/next.config.js index 37598825..06b5fd89 100644 --- a/next.config.js +++ b/next.config.js @@ -1,59 +1,8 @@ const { withContentlayer } = require('next-contentlayer'); - const withBundleAnalyzer = require('@next/bundle-analyzer')({ enabled: process.env.ANALYZE === 'true' }); -// You might need to insert additional domains in script-src if you are using external services -const ContentSecurityPolicy = ` - default-src 'self'; - script-src 'self' 'unsafe-eval' 'unsafe-inline' giscus.app analytics.umami.is www.youtube.com www.googletagmanager.com www.google-analytics.com; - style-src 'self' 'unsafe-inline'; - img-src * blob: data:; - media-src *.s3.amazonaws.com; - connect-src *; - font-src 'self'; - frame-src www.youtube.com youtube.com giscus.app youtu.be; -`; - -const securityHeaders = [ - // https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP - { - key: 'Content-Security-Policy', - value: ContentSecurityPolicy.replace(/\n/g, '') - }, - // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy - { - key: 'Referrer-Policy', - value: 'strict-origin-when-cross-origin' - }, - // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options - { - key: 'X-Frame-Options', - value: 'DENY' - }, - // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options - { - key: 'X-Content-Type-Options', - value: 'nosniff' - }, - // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-DNS-Prefetch-Control - { - key: 'X-DNS-Prefetch-Control', - value: 'on' - }, - // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security - { - key: 'Strict-Transport-Security', - value: 'max-age=31536000; includeSubDomains' - }, - // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy - { - key: 'Permissions-Policy', - value: 'camera=(), microphone=(), geolocation=()' - } -]; - /** * @type {import('next/dist/next-server/server/config').NextConfig} **/ @@ -61,7 +10,7 @@ module.exports = () => { const plugins = [withContentlayer, withBundleAnalyzer]; return plugins.reduce((acc, next) => next(acc), { output: 'export', - // distDir: 'dist', + trailingSlash: true, reactStrictMode: true, pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'], eslint: { @@ -75,15 +24,7 @@ module.exports = () => { } ] }, - // async headers() { - // return [ - // { - // source: '/(.*)', - // headers: securityHeaders - // } - // ]; - // }, - webpack: (config, options) => { + webpack: (config) => { config.module.rules.push({ test: /\.svg$/, use: ['@svgr/webpack'] --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org