Skip to content

Commit

Permalink
refactor: auto-generate excerpt if it's empty (#47)
Browse files Browse the repository at this point in the history
在 WordPress 迁移时,如果 excerpt 为空,则将 `autoGenerate` 设置为 true。

/kind feature

```release-note
WordPress 迁移时,支持自动生成文章摘要。
```
  • Loading branch information
ruibaby authored Jun 24, 2024
1 parent e67f90c commit 075fe7f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions console/src/modules/wordpress/use-wordpress-data-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ export function useWordPressDataParser(
});
return attachment?.["wp:attachment_url"];
})[0];

const excerpt = post["excerpt:encoded"];

return {
postRequest: {
post: {
Expand All @@ -174,8 +177,8 @@ export function useWordPressDataParser(
visible: "PUBLIC",
priority: 0,
excerpt: {
autoGenerate: false,
raw: post["excerpt:encoded"],
autoGenerate: !excerpt,
raw: excerpt,
},
categories: categoryIds,
tags: tagIds,
Expand Down

0 comments on commit 075fe7f

Please sign in to comment.