Skip to content

Conversation

@nicholasio
Copy link
Member

@nicholasio nicholasio commented Apr 29, 2025

Description of the Change

Closes #851

This PR addresses a bug where the default post post type could not sit at a different level than root without disabling post path mapping.

How to test the Change

  1. Update permalinks settings to /blog/%postname%/ in WordPress
  2. Update your customPostTypes in headstartwp.config.js to
 customPostTypes: (defaultPostTypes) => {
      return defaultPostTypes.map((postType) => {
         if (postType.slug === 'post') {
            return { ...postType, single: '/blog', archive: '/blog' };
        }
       return postType;
      });
  };
  1. Verify that /blog route loads both archive of posts and single posts.
  2. Run the test on both the pages router app and App Router app.

Credits

Props @username, @username2, ...

Checklist:

@vercel
Copy link

vercel bot commented Apr 29, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
headstartwp-app-router ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 29, 2025 0:46am
headstarwp ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 29, 2025 0:46am

@changeset-bot
Copy link

changeset-bot bot commented Apr 29, 2025

🦋 Changeset detected

Latest commit: 2343bcf

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@headstartwp/core Patch

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

@github-actions
Copy link
Contributor

📦 Next.js Bundle Analysis for @10up/wp-nextjs-app

This analysis was generated by the Next.js Bundle Analysis action. 🤖

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 83.76 KB (🟢 -42.23 KB)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

@github-actions
Copy link
Contributor

📦 Next.js Bundle Analysis for @10up/headstartwp

This analysis was generated by the Next.js Bundle Analysis action. 🤖

Three Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load % of Budget (145 KB)
/ 9.67 KB 135.66 KB 93.56% (🟡 +0.02%)
/[...path] 6.61 KB 132.61 KB 91.45% (🟡 +0.02%)
/blog/[[...path]] 10.11 KB 136.1 KB 93.86% (🟡 +0.03%)
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

@nicholasio nicholasio changed the title fix: account for possible 'single' property in the default post types… fix: account for possible 'single' property in the default post types for post path matching Apr 29, 2025
@github-actions
Copy link
Contributor

📦 Next.js Bundle Analysis for @10up/wp-nextjs-app

This analysis was generated by the Next.js Bundle Analysis action. 🤖

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 83.76 KB (🟢 -42.23 KB)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

@github-actions
Copy link
Contributor

📦 Next.js Bundle Analysis for @10up/headstartwp

This analysis was generated by the Next.js Bundle Analysis action. 🤖

Three Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load % of Budget (145 KB)
/ 9.67 KB 135.66 KB 93.56% (🟡 +0.02%)
/[...path] 6.61 KB 132.61 KB 91.45% (🟡 +0.02%)
/blog/[[...path]] 10.11 KB 136.1 KB 93.86% (🟡 +0.03%)
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

@nicholasio nicholasio marked this pull request as ready for review April 29, 2025 00:47
@nicholasio nicholasio requested a review from jacobdubail April 29, 2025 00:47
@nicholasio nicholasio merged commit 318c9fa into develop Apr 29, 2025
20 checks passed
@nicholasio nicholasio deleted the fix/post-path-matching-custom-permalink branch April 29, 2025 17:36
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.

Routing with Permalinks set to /blog/%postname%/

2 participants