Skip to content

Conversation

@dimaslanjaka
Copy link
Contributor

What does it do?

This PR introduces or adjusts the :filepath permalink pattern to replicate the previous behavior of :title, which was based on the post's file name and path under source/_posts/.

✅ What this PR does:

  • Restores old permalink behavior via :filepath
  • Enables backward compatibility for existing blogs without requiring manual changes to thousands of posts
  • Preserves legacy URLs and helps prevent SEO regressions or broken external links

🧪 How to test:

  1. Add the following to your _config.yml:
    permalink: :filepath/
  2. Make sure your posts inside source/_posts/ generate the expected permalinks matching the file name.

📌 Related Issue / Discussion:

🙏 Note:

This change helps long-time users maintain their blog structure and avoid unnecessary mass edits due to the breaking permalink change. Especially for blogger/wordpress users who have migrated to Hexo.

🔍 Test Results:

All posts render with the expected permalink structure using the :filepath pattern.

Screenshots

image
image

Pull request tasks

  • Add test cases for the changes.
  • Passed the CI test.

@github-actions
Copy link

github-actions bot commented May 5, 2025

How to test

git clone -b filepath-permalink https://github.com/dimaslanjaka/hexo.git
cd hexo
npm install
npm test

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.

1 participant