Skip to content

Commit

Permalink
add support for index.md in pages directory (ionic-team#741)
Browse files Browse the repository at this point in the history
  • Loading branch information
camwiegert authored Jun 12, 2019
1 parent bfd9041 commit 01ef5f7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions scripts/build-pages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function patchPage(page: Page): Page {
href: `#${heading.getAttribute('id')}`
}));

const pageClass = `page-${slugify(page.path.slice(6))}`;
const pageClass = `page-${slugify(page.path.slice(6) || 'index')}`;

return {
...page,
Expand All @@ -90,4 +90,4 @@ function writePage(page: Page): Promise<any> {
}

const toFilePath = (urlPath: string) =>
`${resolve(PAGES_DIR, urlPath.slice(6))}.json`;
`${resolve(PAGES_DIR, urlPath.slice(6) || 'index')}.json`;
2 changes: 1 addition & 1 deletion scripts/build-pages/page-types/static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const getMarkdownPaths = (cwd: string): Promise<string[]> =>

export const toPage = async (path: string) => {
return {
path: path.replace(PAGES_DIR, '/docs').replace(/\.md$/, ''),
path: path.replace(PAGES_DIR, '/docs').replace(/(\/index)?\.md$/i, ''),
github: await getGitHubData(path),
...renderMarkdown(await readMarkdown(path))
};
Expand Down

0 comments on commit 01ef5f7

Please sign in to comment.