diff --git a/docs/api-site-config.md b/docs/api-site-config.md index b706c69a92..95fbe89495 100644 --- a/docs/api-site-config.md +++ b/docs/api-site-config.md @@ -74,6 +74,8 @@ headerLinks: [ `blogSidebarCount` - Control the number of blog posts that show up in the sidebar. See the [adding a blog docs](guides-blog.md#changing-how-many-blog-posts-show-on-sidebar) for more information. +`cleanUrl` - If `true`, allow URLs with no `html` extension. Example: request to URL https://docusaurus.io/docs/installation will returns the same result as https://docusaurus.io/docs/installation.html. + `cname` - The CNAME for your website. It will go into a `CNAME` file when your site it built. `customDocsPath` - By default, Docusaurus expects your documentation to be in a directory called `docs`. This directory is at the same level as the `website` directory (i.e., not inside the `website` directory). You can specify a custom path to your documentation with this field. **Note that all of your documentation `*.md` files must still reside in a flat hierarchy. You cannot have your documents in nested directories**. @@ -250,6 +252,7 @@ const siteConfig = { twitterUsername: 'docusaurus', twitterImage: 'img/docusaurus.png', ogImage: 'img/docusaurus.png', + cleanUrl: true, scrollToTop: true, scrollToTopOptions: { zIndex: 100 diff --git a/lib/core/BlogPageLayout.js b/lib/core/BlogPageLayout.js index 77cf2116de..e3a815f4e7 100644 --- a/lib/core/BlogPageLayout.js +++ b/lib/core/BlogPageLayout.js @@ -11,6 +11,7 @@ const Container = require('./Container.js'); const MetadataBlog = require('./MetadataBlog.js'); const React = require('react'); const Site = require('./Site.js'); +const utils = require('./utils.js'); // used to generate entire blog pages, i.e. collection of truncated blog posts class BlogPageLayout extends React.Component { @@ -45,7 +46,10 @@ class BlogPageLayout extends React.Component { post={post} content={post.content} truncate={true} - key={post.path + post.title} + key={ + utils.getPath(post.path, this.props.config.cleanUrl) + + post.title + } config={this.props.config} /> ); diff --git a/lib/core/BlogPost.js b/lib/core/BlogPost.js index 09c051b4f7..19126dcb94 100644 --- a/lib/core/BlogPost.js +++ b/lib/core/BlogPost.js @@ -8,7 +8,7 @@ const MarkdownBlock = require('./MarkdownBlock.js'); const React = require('react'); -const utils = require('./utils'); +const utils = require('./utils.js'); // inner blog component for the article itself, without sidebar/header/footer class BlogPost extends React.Component { @@ -24,7 +24,12 @@ class BlogPost extends React.Component { Read More @@ -73,7 +78,12 @@ class BlogPost extends React.Component { const post = this.props.post; return (