Просмотр исходного кода

refs #88095: fix pagetitle links to parmanent url
- If the page path URL is not available due to duplicate page names, use persistent links to process pages with the same name.

NEEDLEMAN3\tatsu 4 лет назад
Родитель
Сommit
a59975a560
1 измененных файлов с 5 добавлено и 1 удалено
  1. 5 1
      packages/app/src/components/PageList/PageListItemL.tsx

+ 5 - 1
packages/app/src/components/PageList/PageListItemL.tsx

@@ -2,6 +2,7 @@ import React, { memo, useCallback } from 'react';
 
 import Clamp from 'react-multiline-clamp';
 import { format } from 'date-fns';
+import urljoin from 'url-join';
 
 import { UserPicture, PageListMeta } from '@growi/ui';
 import { DevidedPagePath } from '@growi/core';
@@ -111,7 +112,10 @@ export const PageListItemL = memo((props: Props): JSX.Element => {
               {/* page title */}
               <Clamp lines={1}>
                 <span className="h5 mb-0">
-                  <PagePathHierarchicalLink linkedPagePath={linkedPagePathLatter} basePath={dPagePath.former} />
+                  {/* Use permanent links to care for pages with the same name (Cannot use page path url) */}
+                  <span className="grw-page-path-hierarchical-link text-break">
+                    <a className="page-segment" href={encodeURI(urljoin('/', pageData._id))}>{linkedPagePathLatter.pathName}</a>
+                  </span>
                 </span>
               </Clamp>