Skip to content

Commit 2ac6aa4

Browse files
committed
feat: optimize seo title
1 parent f50d7de commit 2ac6aa4

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

packages/crd-scripts/src/web/Router.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,21 @@ function menuSourceFormat(data, routePath, article) {
2929
const routePropsCurrent = `${routePath || ''}/${item.name}`.replace(/.md$/, '')
3030
if (item.type === 'directory') {
3131
if (item.children && item.children.length > 0) {
32-
item.title = item.name.replace(item.extension, '')
32+
item.title = 'test aaa'
33+
// item.title = item.name.replace(item.extension, '')
3334
item.mdconf = {}
3435
item.props = { isEmpty: true }
3536
item.children = menuSourceFormat(item.children, routePropsCurrent, article || item.name)
3637
} else {
37-
item.title = item.name.replace(item.extension, '')
38+
item.title = 'test bbb'
39+
// item.title = item.name.replace(item.extension, '')
3840
item.mdconf = { title: item.name }
3941
item.props = { isEmpty: true }
4042
item.children = []
4143
}
4244
} else {
43-
item.title = item.mdconf && item.mdconf.title ? item.mdconf.title : item.name.replace(item.extension, '')
45+
item.title = 'test ccc'
46+
// item.title = item.mdconf && item.mdconf.title ? item.mdconf.title : item.name.replace(item.extension, '')
4447
if (!item.mdconf) {
4548
item.props = { isEmpty: true }
4649
}

packages/crd-seed/layout/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ function BasicLayout({
230230
{/* see https://reacttraining.com/react-router/web/api/Redirect/exact-bool */}
231231
<Redirect exact from={ifAddPrefix ? `/${repo}` : `/`} to={ifAddPrefix ? `/${repo}/${defaultPath}` : `/${defaultPath}`} />
232232
{routeData.map((item) => {
233+
console.log('item', item)
233234
const { path, mdconf, component } = item
234235
const { abbrlink } = mdconf
235236
const enhancePath = abbrlink ? `/${abbrlink}` : path

packages/crd-theme/markdown/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ const components = {
1414

1515
function Markdown(markdownProps) {
1616
const { props } = markdownProps
17-
console.log('props', props)
18-
// todo props.title
1917
const { relative } = props
18+
console.log('props', props)
2019
const [MarkdownCP, setMarkdownCP] = useState(null)
2120
const markdownWrapperRef = useRef(null)
2221

@@ -36,7 +35,10 @@ function Markdown(markdownProps) {
3635
renderMarkdown()
3736
}, [])
3837

39-
console.log('props', props)
38+
useEffect(() => {
39+
// to test
40+
}, [props.title])
41+
4042
return (
4143
<>
4244
<Helmet>

packages/crd-theme/package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"prism-react-renderer": "^1.2.1",
1212
"react": "^17.0.1",
1313
"react-dom": "^17.0.1",
14+
"react-helmet": "^6.1.0",
1415
"react-hot-loader": "^4.1.1",
1516
"react-markdown": "^3.3.0"
1617
},
@@ -25,8 +26,5 @@
2526
},
2627
"author": "muyunyun",
2728
"license": "MIT",
28-
"gitHead": "ffc5e4cbc94a7356da558c2dbf46e2f39bb8b199",
29-
"devDependencies": {
30-
"react-helmet": "^6.1.0"
31-
}
29+
"gitHead": "ffc5e4cbc94a7356da558c2dbf46e2f39bb8b199"
3230
}

0 commit comments

Comments
 (0)