Publish: lint internal links that point at non-live posts

Đang mở
#2 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
72/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
markdown, sqlite, typescript
Lĩnh vực
backend, content

Hướng nghiên cứu

Start in buildLiveSet in src/lib/server/publish.ts, where the publish pass already has the live slug set when it renders post bodies. The new pure function findLinkProblems(body, liveSlugs) belongs in its own module with a *.check.ts file covering the listed link cases. Done means the check passes for every case, warnings appear per post in the Publish view, editor-route links disable the Publish button with a reason, and the rendered .svx text is unchanged.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

good first issue

Context

Posts link to each other by hand with a root-relative slug (/gear). Nothing checks that the target is a live post, so links to drafts, renamed posts and pasted titles ship broken. Publish already knows the full live set when it renders post bodies (buildLiveSet in src/lib/server/publish.ts).

Scope

In the publish pass, scan each live body for links and report:

  • root-relative hrefs whose first segment is not a live slug: a warning per link, shown in the Publish view;
  • hrefs that contain the editor's own origin or start with /posts/ (an editor route, not a site route): block the publish.

Acceptance criteria

  • A pure function findLinkProblems(body, liveSlugs) in its own module with a *.check.ts covering: live slug, unknown slug, renamed slug, editor-route href, external link, anchor-only link, and a title pasted as a path.
  • The Publish view lists warnings per post; editor-route links disable the Publish button with the reason.
  • No change to the rendered .svx text.

Estimate: about 3 hours.

Ngôn ngữ chính
HTML
Star
0
Fork
0
Merge trung bình
1 phút
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của mrgnw/cfcms

Tất cả issue của mrgnw/cfcms

Issue tương tự

Thêm issue về Backend & API Design

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.