Import from a file: ask the old site for its category and tag prefixes when the content doesn't show them

未关闭
#697 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
laravel, php
领域
backend, frontend

调研方向

Start in app/Domain/Import/File/FileAddresses.php at bases(), which picks the prefix from content links and falls back to the WordPress defaults. Then read app/Domain/Media/Downloads/FileDownloader.php to see how the checked, pinned requests to the old site are made, and resources/js/components/import/file-plan.tsx for where the prefixes are shown. Done means that a site with no prefix-revealing links gets its prefixes from the old site's category and tag addresses, and the content links and defaults still apply as before.

由索引模型根据 Issue 内容生成。

描述

area/import type/enhancement when/later

What happens now

When an export file is read, Teme guesses the old site's category and tag prefixes (FileAddresses::bases()): it looks at the links in the content that point to the site's own categories and tags, and takes the prefix they use most. When the content has no such links, it falls back to WordPress's defaults, category and tag.

So a site that stripped the category prefix (for example with Yoast's "Remove category prefix") and whose posts never link to a category gets category prefilled. Someone who doesn't remember the old setting imports with the wrong addresses, and every old category link answers 404.

What it could do

When the old site answers (the plan page already asks it, for the media download), and the content gave no answer, ask the site itself: request one category's address with the prefix and without (/category/<slug>/ and /<slug>/), and one tag's the same way, and prefill whichever answers. The links in the content still decide when they exist; WordPress's defaults stay the last fallback. The person can still change the prefixes on the plan page, as today.

Where: app/Domain/Import/File/FileAddresses.php (bases()), app/Domain/Media/Downloads/FileDownloader.php (the checked, pinned requests to the old site), resources/js/components/import/file-plan.tsx.

Related: #696 (the same check of the old site).

主要语言
PHP
星标
1
派生
1
平均合并
1 小时 40 分钟
30 天内合并 PR
143

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

temecms/teme 的其他 Issue

查看 temecms/teme 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。