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

Generate sitemap with only canonical urls #7131

Merged
merged 15 commits into from
Apr 29, 2024
Merged

Conversation

timngyn
Copy link
Member

@timngyn timngyn commented Mar 27, 2024

Description of changes:

  • Added package cheerio to help parse HTML build files
  • Updated generate sitemap script to run after build and process HTML build files and compare the main elements in each of the HTML files. After comparing them, we group the duplicate pages and select one to be the canonical url based on its platform ranking. We use this selected url in the sitemap to denote that it is a canonical url.

sitemap built from this branch: https://canonical-sitemap.d1ywzrxfkb9wgg.amplifyapp.com/sitemap.xml

Staging site: https://canonical-sitemap.d1ywzrxfkb9wgg.amplifyapp.com/

Related GitHub issue #, if available:

Instructions

If this PR should not be merged upon approval for any reason, please submit as a DRAFT

Which product(s) are affected by this PR (if applicable)?

  • amplify-cli
  • amplify-ui
  • amplify-studio
  • amplify-hosting
  • amplify-libraries

Which platform(s) are affected by this PR (if applicable)?

  • JS
  • Swift
  • Android
  • Flutter
  • React Native

Please add the product(s)/platform(s) affected to the PR title

Checks

  • Does this PR conform to the styleguide?

  • Does this PR include filetypes other than markdown or images? Please add or update unit tests accordingly.

  • Are any files being deleted with this PR? If so, have the needed redirects been created?

  • Are all links in MDX files using the MDX link syntax rather than HTML link syntax?

    ref: MDX: [link](https://docs.amplify.aws/)
    HTML: <a href="https://docs.amplify.aws/">link</a>

When this PR is ready to merge, please check the box below

  • Ready to merge

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@timngyn timngyn changed the title Canonical sitemap Generate sitemap with only canonical urls Mar 27, 2024
tasks/generate-sitemap.mjs Fixed Show fixed Hide fixed
@timngyn timngyn marked this pull request as ready for review April 9, 2024 20:24
@timngyn timngyn requested a review from a team as a code owner April 9, 2024 20:24
console.log(`${path} doesn't exist`);
return formatDate(new Date());
};
const PLATFORMS = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

@timngyn timngyn Apr 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I tried to do that originally, it kept throwing an error saying it couldn't find the module @data/platforms. I also tried specifying the relative path ../src/data/platforms.js but that didn't work either. Maybe I'm doing something wrong though? Do you have any thoughts on what I tried so far?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it's because platforms.ts is a typescript file and it needs to be a complied js file? 🤔

@timngyn timngyn merged commit 731a394 into next-release/main Apr 29, 2024
5 checks passed
@timngyn timngyn deleted the canonical-sitemap branch April 29, 2024 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants