Skip to content

feat: automation of new urls added in sitemap using new slugs on wordpress - 🚧#346

Open
amaan-bhati wants to merge 2 commits intomainfrom
sitemap-automation
Open

feat: automation of new urls added in sitemap using new slugs on wordpress - 🚧#346
amaan-bhati wants to merge 2 commits intomainfrom
sitemap-automation

Conversation

@amaan-bhati
Copy link
Member

Related Tickets & Documents

Fixes: #[issue-number]

Description

Changes

Type of Change

  • Chore (maintenance, refactoring, tooling updates)
  • Bug fix (non-breaking change that fixes an issue)
  • New feature (change that adds functionality)
  • Breaking Change (may require updates in existing code)
  • UI improvement (visual or design changes)
  • Performance improvement (optimization or efficiency enhancements)
  • Documentation update (changes to README, guides, etc.)
  • CI (updates to continuous integration workflows)
  • Revert (undo a previous commit or merge)

Testing

Demo

Environment and Dependencies

  • New Dependencies:
  • Configuration Changes:

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added corresponding tests
  • I have run the build command to ensure there are no build errors
  • My changes have been tested across relevant browsers/devices
  • For UI changes, I've included visual evidence of my changes

Signed-off-by: amaan-bhati <amaanbhati49@gmail.com>
…press

Signed-off-by: amaan-bhati <amaanbhati49@gmail.com>
Copilot AI review requested due to automatic review settings March 12, 2026 01:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces automation to keep public/sitemap.xml updated with new WordPress blog post URLs (technology/community) by adding sync scripts and a scheduled GitHub Actions workflow that opens an automated PR when changes are detected.

Changes:

  • Added Node scripts to fetch post slugs from WPGraphQL and append missing /blog/technology/* and /blog/community/* entries into public/sitemap.xml.
  • Added npm scripts to run the sitemap sync from CI.
  • Added a scheduled GitHub Actions workflow to run the sync periodically and create a PR with sitemap updates.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
scripts/sync-tech-urls-to-sitemap.mjs Adds a script to fetch technology posts from WPGraphQL and append missing sitemap <url> entries.
scripts/sync-blog-urls-to-sitemap.mjs Adds a script to fetch all posts, map them to community/technology URLs, and append missing sitemap entries.
public/sitemap.xml Updates the sitemap content with many new/changed entries.
package.json Adds npm scripts to run the sitemap sync scripts.
.github/workflows/sitemap_sync.yml Adds a scheduled workflow to run the sync and open an automated PR.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +1 to 2
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

public/sitemap.xml is not valid XML: the first line is a plain-text message (likely copied from a browser view) and the XML prolog (<?xml version="1.0" encoding="UTF-8"?>) is missing. This will break sitemap consumers and will also fail the workflow xmllint validation; remove the plain-text line and restore the XML declaration at the top of the file.

Copilot uses AI. Check for mistakes.
Comment on lines +4 to +16
<url>
<loc>https://keploy.io/blog</loc>
<lastmod>2026-03-11T21:50:59+00:00</lastmod>
<priority>1.00</priority>
</url>
<url>
<loc>https://keploy.io/blog/technology</loc>
<lastmod>2026-03-11T21:50:59+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://keploy.io/blog/community</loc>
<lastmod>2026-03-11T21:50:59+00:00</lastmod>
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

Many <lastmod> values appear to have been rewritten to the same sync timestamp (e.g. the /blog, /blog/technology, /blog/community entries). lastmod is intended to reflect the actual last modification time of each URL; setting it to a bulk-generated timestamp can mislead crawlers and trigger unnecessary recrawls. Prefer keeping existing lastmod values unchanged and only setting lastmod for newly added URLs based on WordPress modified/date.

Copilot uses AI. Check for mistakes.
Comment on lines +88 to +93
const loc = normalizeUrl(`https://keploy.io/blog/technology/${node.slug}`);
const lastmod = toIso(node.modified) || toIso(node.date) || "2026-03-11T21:50:59+00:00";
return {
loc,
xml: `<url>\n<loc>${loc}</loc>\n<lastmod>${lastmod}</lastmod>\n<priority>0.51</priority>\n</url>\n`,
};
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

lastmod falls back to a hard-coded timestamp. If modified/date is missing or unparsable, this will silently write a stale value and is easy to forget to update later. Prefer using the current time (or omitting <lastmod> when unknown) instead of a fixed constant.

Copilot uses AI. Check for mistakes.
Comment on lines +110 to +118
const url = buildBlogUrl(node);
if (!url) return null;
const loc = normalizeUrl(url);
const lastmod = toIso(node.modified) || toIso(node.date) || "2026-03-11T21:50:59+00:00";
return {
loc,
lastmod,
xml: `<url>\n<loc>${loc}</loc>\n<lastmod>${lastmod}</lastmod>\n<priority>0.51</priority>\n</url>\n`,
};
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

lastmod falls back to a hard-coded timestamp. If modified/date is missing or unparsable, this will write an arbitrary (and eventually stale) value into the sitemap. Prefer using the current time (or omitting <lastmod> when unknown) rather than a fixed constant.

Copilot uses AI. Check for mistakes.
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.

2 participants