Skip to content

Commit 0becb1d

Browse files
committed
fix: edit in github
1 parent c251565 commit 0becb1d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/crd-seed/layout/index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,23 @@ function BasicLayout({
136136
* such as edit in github and so on.
137137
*/
138138
const renderPageHeader = () => {
139-
const curMenuSource = menuSource.filter(r => pathname.indexOf(r.title) > -1)
139+
console.log('routeData', routeData)
140+
console.log('menuSource', menuSource)
141+
const curMenuSource = routeData.filter(r => {
142+
if (r.props.type === 'directory') return false
143+
return pathname.indexOf(r.mdconf.abbrlink) > -1 || decodeURIComponent(pathname).indexOf(r.path) > -1
144+
})
140145
const editPathName = curMenuSource[0] && curMenuSource[0].path
146+
console.log('curMenuSource', curMenuSource)
147+
console.log('a link', `https://github.com/${user}/${repo
148+
}/edit/${branch}${editPathName}.md`)
141149
return (
142150
<div className={cx(styles.pageHeader)}>
143151
{user && repo ? (
144152
<a
145153
href={`https://github.com/${user}/${
146154
repo
147-
}/edit/${branch}${editPathName}`}
155+
}/edit/${branch}${editPathName}.md`}
148156
target="_blank"
149157
>
150158
<Icon className={cx(styles.icon)} type="edit" size={13} />

0 commit comments

Comments
 (0)