Skip to main content

sort-redirects

Sorts redirect entries in Open Publishing redirection JSON files alphabetically by path. Use after adding redirects or when the file becomes unsorted.

来源信息

仓库
dotnet/docs
最近来源活动
2026年2月20日 19:26
检测到的 SKILL.md 语言
英语
星标
4,771
分支
6,072

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

文件资源管理器
2 个文件

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
sort-redirects
description
Sorts redirect entries in Open Publishing redirection JSON files alphabetically by path. Use after adding redirects or when the file becomes unsorted.
# Sort Redirects Sort redirect entries in Open Publishing redirection JSON files alphabetically by path. This ensures consistency and makes the redirect files easier to maintain. ## When to Use - After adding redirect entries to a JSON file - When the redirect file has become unsorted - After merging branches that may have caused unsorted entries ## Steps 1. **Identify the redirection file** - Determine which `.openpublishing.redirection.*.json` file needs sorting. 2. **Run the sort script** - Use the `sort-redirects.ps1` script with the file path. ## Scripts ### sort-redirects.ps1 Sorts all entries in the JSON file alphabetically by path (ignoring leading `/` for `source_path_from_root`). Handles both `source_path_from_root` and `source_path` properties. Location (relative to this skill file): `./scripts/sort-redirects.ps1` | Parameter | Required | Description | |-----------|----------|-------------| | `RedirectionFile` | Yes | The path to a redirection JSON file (e.g., `.openpublishing.redirection.csharp.json`) | **Example:** ```powershell .\scripts\sort-redirects.ps1 -RedirectionFile ".openpublishing.redirection.csharp.json" ``` ## Important Notes - The script preserves all existing redirect entries, only changing their order. - Sorting is case-sensitive and alphabetical by the normalized path (without leading `/`).
在 GitHub 查看