@docusaurus/plugin-content-blog
Advanced tools
Comparing version 2.0.0-alpha.88a6f5665 to 2.0.0-alpha.8a9dfcf96
@@ -17,2 +17,3 @@ "use strict"; | ||
const path_1 = __importDefault(require("path")); | ||
const url_1 = require("url"); | ||
const reading_time_1 = __importDefault(require("reading-time")); | ||
@@ -153,4 +154,6 @@ const feed_1 = require("feed"); | ||
const mdLink = mdMatch[1]; | ||
const aliasedPostSource = `@site/${path_1.default.relative(siteDir, path_1.default.resolve(folderPath, mdLink))}`; | ||
const blogPost = blogPostsBySource[aliasedPostSource]; | ||
const aliasedSource = (source) => utils_1.aliasedSitePath(source, siteDir); | ||
const blogPost = blogPostsBySource[aliasedSource(url_1.resolve(filePath, mdLink))] || | ||
blogPostsBySource[aliasedSource(`${contentPaths.contentPathLocalized}/${mdLink}`)] || | ||
blogPostsBySource[aliasedSource(`${contentPaths.contentPath}/${mdLink}`)]; | ||
if (blogPost) { | ||
@@ -157,0 +160,0 @@ modifiedLine = modifiedLine.replace(mdLink, blogPost.metadata.permalink); |
@@ -41,3 +41,3 @@ "use strict"; | ||
const dataDir = path_1.default.join(pluginDataDirRoot, pluginId); | ||
const aliasedSource = (source) => `~blog/${path_1.default.relative(pluginDataDirRoot, source)}`; | ||
const aliasedSource = (source) => `~blog/${utils_1.posixPath(path_1.default.relative(pluginDataDirRoot, source))}`; | ||
let blogPosts = []; | ||
@@ -297,3 +297,5 @@ return { | ||
test: /(\.mdx?)$/, | ||
include: blogUtils_1.getContentPathList(contentPaths), | ||
include: blogUtils_1.getContentPathList(contentPaths) | ||
// Trailing slash is important, see https://github.com/facebook/docusaurus/pull/3970 | ||
.map(utils_1.addTrailingPathSeparator), | ||
use: [ | ||
@@ -300,0 +302,0 @@ getCacheLoader(isServer), |
{ | ||
"name": "@docusaurus/plugin-content-blog", | ||
"version": "2.0.0-alpha.88a6f5665", | ||
"version": "2.0.0-alpha.8a9dfcf96", | ||
"description": "Blog plugin for Docusaurus", | ||
@@ -21,7 +21,7 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@docusaurus/core": "2.0.0-alpha.88a6f5665", | ||
"@docusaurus/mdx-loader": "2.0.0-alpha.88a6f5665", | ||
"@docusaurus/types": "2.0.0-alpha.88a6f5665", | ||
"@docusaurus/utils": "2.0.0-alpha.88a6f5665", | ||
"@docusaurus/utils-validation": "2.0.0-alpha.88a6f5665", | ||
"@docusaurus/core": "2.0.0-alpha.8a9dfcf96", | ||
"@docusaurus/mdx-loader": "2.0.0-alpha.8a9dfcf96", | ||
"@docusaurus/types": "2.0.0-alpha.8a9dfcf96", | ||
"@docusaurus/utils": "2.0.0-alpha.8a9dfcf96", | ||
"@docusaurus/utils-validation": "2.0.0-alpha.8a9dfcf96", | ||
"chalk": "^3.0.0", | ||
@@ -45,3 +45,3 @@ "feed": "^4.2.1", | ||
}, | ||
"gitHead": "2cdec850c9d85e6b31bc292b2dec77ae80b186a1" | ||
"gitHead": "0cb6aea7cb2b63e7198dc30011399cc2ab56498d" | ||
} |
@@ -68,3 +68,3 @@ /** | ||
readingTime: 0.02, | ||
source: path.join('@site', pluginPath, 'date-matter.md'), | ||
source: path.posix.join('@site', pluginPath, 'date-matter.md'), | ||
title: 'date-matter', | ||
@@ -91,6 +91,6 @@ description: `date inside front matter`, | ||
readingTime: 0.015, | ||
source: path.join( | ||
source: path.posix.join( | ||
'@site', | ||
// pluginPath, | ||
path.join('i18n', 'en', 'docusaurus-plugin-content-blog'), | ||
path.posix.join('i18n', 'en', 'docusaurus-plugin-content-blog'), | ||
'2018-12-14-Happy-First-Birthday-Slash.md', | ||
@@ -117,3 +117,3 @@ ), | ||
readingTime: 0.015, | ||
source: path.join('@site', pluginPath, 'complex-slug.md'), | ||
source: path.posix.join('@site', pluginPath, 'complex-slug.md'), | ||
title: 'Complex Slug', | ||
@@ -139,3 +139,3 @@ description: `complex url slug`, | ||
readingTime: 0.015, | ||
source: path.join('@site', pluginPath, 'simple-slug.md'), | ||
source: path.posix.join('@site', pluginPath, 'simple-slug.md'), | ||
title: 'Simple Slug', | ||
@@ -169,3 +169,3 @@ description: `simple url slug`, | ||
const blogPosts = await getBlogPosts(siteDir); | ||
const noDateSource = path.join('@site', pluginPath, 'no date.md'); | ||
const noDateSource = path.posix.join('@site', pluginPath, 'no date.md'); | ||
const noDateSourceBirthTime = ( | ||
@@ -172,0 +172,0 @@ await fs.stat(noDateSource.replace('@site', siteDir)) |
@@ -24,3 +24,3 @@ /** | ||
permalink: '/blog/2018/12/14/Happy-First-Birthday-Slash', | ||
source: path.join( | ||
source: path.posix.join( | ||
'@site', | ||
@@ -27,0 +27,0 @@ pluginDir, |
@@ -12,2 +12,3 @@ /** | ||
import path from 'path'; | ||
import {resolve} from 'url'; | ||
import readingTime from 'reading-time'; | ||
@@ -244,9 +245,14 @@ import {Feed} from 'feed'; | ||
const mdLink = mdMatch[1]; | ||
const aliasedPostSource = `@site/${path.relative( | ||
siteDir, | ||
path.resolve(folderPath, mdLink), | ||
)}`; | ||
const aliasedSource = (source: string) => | ||
aliasedSitePath(source, siteDir); | ||
const blogPost: BlogPost | undefined = | ||
blogPostsBySource[aliasedPostSource]; | ||
blogPostsBySource[aliasedSource(resolve(filePath, mdLink))] || | ||
blogPostsBySource[ | ||
aliasedSource(`${contentPaths.contentPathLocalized}/${mdLink}`) | ||
] || | ||
blogPostsBySource[ | ||
aliasedSource(`${contentPaths.contentPath}/${mdLink}`) | ||
]; | ||
@@ -253,0 +259,0 @@ if (blogPost) { |
@@ -17,2 +17,4 @@ /** | ||
reportMessage, | ||
posixPath, | ||
addTrailingPathSeparator, | ||
} from '@docusaurus/utils'; | ||
@@ -88,3 +90,3 @@ import { | ||
const aliasedSource = (source: string) => | ||
`~blog/${path.relative(pluginDataDirRoot, source)}`; | ||
`~blog/${posixPath(path.relative(pluginDataDirRoot, source))}`; | ||
@@ -440,3 +442,5 @@ let blogPosts: BlogPost[] = []; | ||
test: /(\.mdx?)$/, | ||
include: getContentPathList(contentPaths), | ||
include: getContentPathList(contentPaths) | ||
// Trailing slash is important, see https://github.com/facebook/docusaurus/pull/3970 | ||
.map(addTrailingPathSeparator), | ||
use: [ | ||
@@ -443,0 +447,0 @@ getCacheLoader(isServer), |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
594401
2526
+ Added@docusaurus/core@2.0.0-alpha.8a9dfcf96(transitive)
+ Added@docusaurus/cssnano-preset@2.0.0-alpha.8a9dfcf96(transitive)
+ Added@docusaurus/mdx-loader@2.0.0-alpha.8a9dfcf96(transitive)
+ Added@docusaurus/types@2.0.0-alpha.8a9dfcf96(transitive)
+ Added@docusaurus/utils@2.0.0-alpha.8a9dfcf96(transitive)
+ Added@docusaurus/utils-validation@2.0.0-alpha.8a9dfcf96(transitive)
- Removed@docusaurus/core@2.0.0-alpha.88a6f5665(transitive)
- Removed@docusaurus/cssnano-preset@2.0.0-alpha.88a6f5665(transitive)
- Removed@docusaurus/mdx-loader@2.0.0-alpha.88a6f5665(transitive)
- Removed@docusaurus/types@2.0.0-alpha.88a6f5665(transitive)
- Removed@docusaurus/utils@2.0.0-alpha.88a6f5665(transitive)
- Removed@docusaurus/utils-validation@2.0.0-alpha.88a6f5665(transitive)