-
Notifications
You must be signed in to change notification settings - Fork 1
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
[DEV-2129] Sitemap for standalone version #1368
base: poc-standalone
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 1209755 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This PR exceeds the recommended size of 800 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
Jira Pull Request LinkThis Pull Request refers to the following Jira issue DEV-2129 |
Bundle not found for branch |
// Debug environment variables | ||
console.log('Environment variables:'); | ||
console.log(`S3_ACCESS_KEY_ID: ${S3_ACCESS_KEY_ID ? '****' : 'not set'}`); | ||
console.log( | ||
`S3_SECRET_ACCESS_KEY: ${S3_SECRET_ACCESS_KEY ? '****' : 'not set'}` | ||
); | ||
console.log(`S3_BUCKET_NAME: ${S3_BUCKET_NAME || 'not set'}`); | ||
console.log(`S3_PATH_TO_GITBOOK_DOCS: ${S3_PATH_TO_GITBOOK_DOCS}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Debug environment variables | |
console.log('Environment variables:'); | |
console.log(`S3_ACCESS_KEY_ID: ${S3_ACCESS_KEY_ID ? '****' : 'not set'}`); | |
console.log( | |
`S3_SECRET_ACCESS_KEY: ${S3_SECRET_ACCESS_KEY ? '****' : 'not set'}` | |
); | |
console.log(`S3_BUCKET_NAME: ${S3_BUCKET_NAME || 'not set'}`); | |
console.log(`S3_PATH_TO_GITBOOK_DOCS: ${S3_PATH_TO_GITBOOK_DOCS}`); |
const S3_SECRET_ACCESS_KEY = process.env.S3_SECRET_ACCESS_KEY; | ||
const S3_BUCKET_NAME = process.env.S3_BUCKET_NAME; | ||
const S3_PATH_TO_GITBOOK_DOCS = process.env.S3_PATH_TO_GITBOOK_DOCS || 'docs'; | ||
const AWS_REGION = 'eu-south-1'; // Using the region from your .env file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const AWS_REGION = 'eu-south-1'; // Using the region from your .env file | |
const AWS_REGION = process.env.NEXT_PUBLIC_COGNITO_REGION; |
// Function to extract title from markdown content | ||
function extractTitleFromMarkdown(content: string): string { | ||
const titleMatch = content.match(/^#\s+(.+)$/m); | ||
if (titleMatch) { | ||
let title = titleMatch[1].trim(); | ||
// Remove any emojis or special characters | ||
title = title.replace(/[\u{1F600}-\u{1F6FF}]/gu, ''); | ||
return title; | ||
} | ||
return 'Untitled'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont know if this function do the same thing but you can find parseTitle
in apps/nextjs-website/src/helpers/parseS3Doc.helpers.ts
that extract the title from the markdown.
function generateUrlPathWithStrapiData( | ||
dirName: string, | ||
filePath: string, | ||
strapiGuides: StrapiGuide[], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strapiGuides: StrapiGuide[], |
}; | ||
}; | ||
}; | ||
[key: string]: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this file is not necessary
[key: string]: any; |
function generateUrlPathWithStrapiData( | ||
dirName: string, | ||
filePath: string, | ||
strapiGuides: StrapiGuide[], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think is not used anymore
strapiGuides: StrapiGuide[], |
for (let i = 0; i < Math.min(dirNames.length, strapiGuides.length); i++) { | ||
dirToGuideMap[dirNames[i]] = strapiGuides[i]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don think this could function properly... i think you should add some matching that checks strapiGuide dirName with S3 dirName 🤔
// Also write a sample item to the console | ||
if (sitemapItems.length > 0) { | ||
console.log('Sample sitemap item:'); | ||
console.log(JSON.stringify(sitemapItems[0], null, 2)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Also write a sample item to the console | |
if (sitemapItems.length > 0) { | |
console.log('Sample sitemap item:'); | |
console.log(JSON.stringify(sitemapItems[0], null, 2)); | |
} |
List of Changes
Restore sitemp for standalone version including guides data fetched from S3 and the script to save it
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: