mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-02 03:37:48 +02:00
RSS/ATOM Feed added, Prism changes, and global Copyright notice. (#94)
* Add Reason support to Prism.js * Add XML/ATOM feed. Generates for both localhost and build script. Adds meta links to feeds to all html files. * Updated /core/Footer.js to pull from siteConfig
This commit is contained in:
parent
92ce92ee59
commit
dc835770a0
15 changed files with 285 additions and 39 deletions
|
@ -57,6 +57,8 @@ headerLinks: [
|
||||||
- `prismColor` is the color used in the background of syntax highlighting for code in documentation. It is recommended to be the same color as `primaryColor` in `rgba` form with an alpha value of `0.03`. Other fields can be added
|
- `prismColor` is the color used in the background of syntax highlighting for code in documentation. It is recommended to be the same color as `primaryColor` in `rgba` form with an alpha value of `0.03`. Other fields can be added
|
||||||
- Custom color configurations can also be added. For example, if user styles are added with colors specified as `$myColor`, then adding a `myColor` field to `colors` will allow you to easily configure this color.
|
- Custom color configurations can also be added. For example, if user styles are added with colors specified as `$myColor`, then adding a `myColor` field to `colors` will allow you to easily configure this color.
|
||||||
|
|
||||||
|
`copyright` - The copyright string at footer of site and within feed
|
||||||
|
|
||||||
### Optional Fields
|
### Optional Fields
|
||||||
|
|
||||||
`editUrl` - url for editing docs, usage example: `editUrl + 'en/doc1.md'`. If this field is omitted, there will be no "Edit this Doc" button for each document.
|
`editUrl` - url for editing docs, usage example: `editUrl + 'en/doc1.md'`. If this field is omitted, there will be no "Edit this Doc" button for each document.
|
||||||
|
|
|
@ -67,3 +67,9 @@ Not this.
|
||||||
|
|
||||||
Or this.
|
Or this.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## RSS Feed
|
||||||
|
|
||||||
|
Docusaurus provides a simple RSS feed for your blog posts. Both RSS and Atom feed formats are supported. This data is automatically to your website page's HTML <HEAD> tag.
|
||||||
|
|
||||||
|
A summary of the post's text is provided in the RSS feed up to the `<!--truncate-->`. If no `<!--truncate-->` tag is found, then all text up 250 chacters are used.
|
|
@ -24,10 +24,10 @@ const siteConfig = {
|
||||||
baseUrl: "/test-site/" /* base url for your project */,
|
baseUrl: "/test-site/" /* base url for your project */,
|
||||||
projectName: "test-site",
|
projectName: "test-site",
|
||||||
headerLinks: [
|
headerLinks: [
|
||||||
{ doc: "doc1", label: "Docs" },
|
{doc: "doc1", label: "Docs"},
|
||||||
{ doc: "doc4", label: "API" },
|
{doc: "doc4", label: "API"},
|
||||||
{ page: "help", label: "Help" },
|
{page: "help", label: "Help"},
|
||||||
{ blog: true, label: "Blog" }
|
{blog: true, label: "Blog"}
|
||||||
],
|
],
|
||||||
users,
|
users,
|
||||||
/* path to images for header/footer */
|
/* path to images for header/footer */
|
||||||
|
@ -40,7 +40,12 @@ const siteConfig = {
|
||||||
secondaryColor: "#205C3B",
|
secondaryColor: "#205C3B",
|
||||||
prismColor:
|
prismColor:
|
||||||
"rgba(46, 133, 85, 0.03)" /* primaryColor in rgba form, with 0.03 alpha */
|
"rgba(46, 133, 85, 0.03)" /* primaryColor in rgba form, with 0.03 alpha */
|
||||||
}
|
},
|
||||||
|
// This copyright info is used in /core/Footer.js and blog rss/atom feeds.
|
||||||
|
copyright:
|
||||||
|
"Copyright © " +
|
||||||
|
new Date().getFullYear() +
|
||||||
|
" Your Name or Your Company Name"
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = siteConfig;
|
module.exports = siteConfig;
|
||||||
|
|
|
@ -12,37 +12,58 @@ const React = require("react");
|
||||||
// html head for each page
|
// html head for each page
|
||||||
class Head extends React.Component {
|
class Head extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
|
let links = this.props.config.headerLinks;
|
||||||
|
let hasBlog = false;
|
||||||
|
links.map(link => {
|
||||||
|
if (link.blog) hasBlog = true;
|
||||||
|
});
|
||||||
return (
|
return (
|
||||||
<head>
|
<head>
|
||||||
<meta charSet="utf-8" />
|
<meta charSet="utf-8" />
|
||||||
<meta httpEquiv="X-UA-Compatible" content="IE=edge, chrome=1" />
|
<meta httpEquiv="X-UA-Compatible" content="IE=edge, chrome=1" />
|
||||||
<title>
|
<title>{this.props.title}</title>
|
||||||
{this.props.title}
|
|
||||||
</title>
|
|
||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<meta property="og:title" content={this.props.title} />
|
<meta property="og:title" content={this.props.title} />
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
<meta property="og:url" content={this.props.url} />
|
<meta property="og:url" content={this.props.url} />
|
||||||
<meta property="og:description" content={this.props.description} />
|
<meta property="og:description" content={this.props.description} />
|
||||||
<meta name="robots" content="noindex" />
|
<meta name="robots" content="noindex" />
|
||||||
{this.props.config.ogImage &&
|
{this.props.config.ogImage && (
|
||||||
<meta
|
<meta
|
||||||
property="og:image"
|
property="og:image"
|
||||||
content={this.props.config.baseUrl + this.props.config.ogImage}
|
content={this.props.config.baseUrl + this.props.config.ogImage}
|
||||||
/>}
|
/>
|
||||||
|
)}
|
||||||
<link
|
<link
|
||||||
rel="shortcut icon"
|
rel="shortcut icon"
|
||||||
href={this.props.config.baseUrl + this.props.config.favicon}
|
href={this.props.config.baseUrl + this.props.config.favicon}
|
||||||
/>
|
/>
|
||||||
{this.props.config.algolia &&
|
{this.props.config.algolia && (
|
||||||
<link
|
<link
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"
|
href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"
|
||||||
/>}
|
/>
|
||||||
|
)}
|
||||||
<link
|
<link
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
href={this.props.config.baseUrl + "css/main.css"}
|
href={this.props.config.baseUrl + "css/main.css"}
|
||||||
/>
|
/>
|
||||||
|
{hasBlog && (
|
||||||
|
<link
|
||||||
|
rel="alternate"
|
||||||
|
type="application/atom+xml"
|
||||||
|
href={this.props.config.url + "/blog/atom.xml"}
|
||||||
|
title={this.props.config.title + " Blog ATOM Feed"}
|
||||||
|
/>
|
||||||
|
)}{" "}
|
||||||
|
{hasBlog && (
|
||||||
|
<link
|
||||||
|
rel="alternate"
|
||||||
|
type="application/rss+xml"
|
||||||
|
href={this.props.config.url + "/blog/feed.xml"}
|
||||||
|
title={this.props.config.title + " Blog RSS Feed"}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<script async defer src="https://buttons.github.io/buttons.js" />
|
<script async defer src="https://buttons.github.io/buttons.js" />
|
||||||
</head>
|
</head>
|
||||||
);
|
);
|
||||||
|
|
33
lib/generate-feed.js
Normal file
33
lib/generate-feed.js
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2017-present, Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the BSD-style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
require("babel-register")({
|
||||||
|
babelrc: false,
|
||||||
|
only: [__dirname, process.cwd() + "/core"],
|
||||||
|
plugins: [require("./server/translate-plugin.js")],
|
||||||
|
presets: ["react", "latest"]
|
||||||
|
});
|
||||||
|
|
||||||
|
// initial check that required files are present
|
||||||
|
const chalk = require("chalk");
|
||||||
|
const fs = require("fs");
|
||||||
|
const CWD = process.cwd();
|
||||||
|
|
||||||
|
if (!fs.existsSync(CWD + "/siteConfig.js")) {
|
||||||
|
console.error(
|
||||||
|
chalk.red("Error: No siteConfig.js file found in website folder!")
|
||||||
|
);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// generate rss feed
|
||||||
|
const feed = require("./server/feed.js");
|
||||||
|
console.log(feed());
|
111
lib/server/feed.js
Normal file
111
lib/server/feed.js
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2017-present, Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the BSD-style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const fs = require("fs-extra");
|
||||||
|
const path = require("path");
|
||||||
|
const os = require("os");
|
||||||
|
const Feed = require("feed");
|
||||||
|
|
||||||
|
const chalk = require("chalk");
|
||||||
|
const CWD = process.cwd();
|
||||||
|
|
||||||
|
const siteConfig = require(CWD + "/siteConfig.js");
|
||||||
|
|
||||||
|
const blogFolder = path.resolve("../blog/");
|
||||||
|
const blogRootURL = siteConfig.url + "/blog";
|
||||||
|
const jestImage = siteConfig.url + siteConfig.headerIcon;
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
let readMetadata;
|
||||||
|
let Metadata;
|
||||||
|
|
||||||
|
function reloadMetadata() {
|
||||||
|
removeFromCache("./readMetadata.js");
|
||||||
|
readMetadata = require("./readMetadata.js");
|
||||||
|
readMetadata.generateDocsMetadata();
|
||||||
|
removeFromCache("../core/metadata.js");
|
||||||
|
Metadata = require("../core/metadata.js");
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
// remove a module and child modules from require cache, so server does not have
|
||||||
|
// to be restarted
|
||||||
|
const removeFromCache = moduleName => {
|
||||||
|
let mod = require.resolve(moduleName);
|
||||||
|
if (mod && (mod = require.cache[mod])) {
|
||||||
|
(function traverse(mod) {
|
||||||
|
mod.children.forEach(child => {
|
||||||
|
traverse(child);
|
||||||
|
});
|
||||||
|
delete require.cache[mod.id];
|
||||||
|
})(mod);
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.keys(module.constructor._pathCache).forEach(function(cacheKey) {
|
||||||
|
if (cacheKey.indexOf(moduleName) > 0) {
|
||||||
|
delete module.constructor._pathCache[cacheKey];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
reloadMetadata();
|
||||||
|
|
||||||
|
module.exports = function(type) {
|
||||||
|
console.log("feed.js triggered...");
|
||||||
|
|
||||||
|
type = type || "rss";
|
||||||
|
|
||||||
|
removeFromCache(CWD + "/siteConfig.js");
|
||||||
|
if (fs.existsSync(__dirname + "/../core/MetadataBlog.js")) {
|
||||||
|
removeFromCache("../core/MetadataBlog.js");
|
||||||
|
fs.removeSync(__dirname + "/../core/MetadataBlog.js");
|
||||||
|
}
|
||||||
|
readMetadata.generateBlogMetadata();
|
||||||
|
const MetadataBlog = require("../core/MetadataBlog.js");
|
||||||
|
|
||||||
|
const feed = new Feed({
|
||||||
|
title: siteConfig.title + " Blog",
|
||||||
|
description:
|
||||||
|
"The best place to stay up-to-date with the latest " +
|
||||||
|
siteConfig.title +
|
||||||
|
" news and events.",
|
||||||
|
id: blogRootURL,
|
||||||
|
link: blogRootURL,
|
||||||
|
image: jestImage,
|
||||||
|
copyright: siteConfig.copyright,
|
||||||
|
updated: new Date(MetadataBlog[0].date)
|
||||||
|
});
|
||||||
|
|
||||||
|
MetadataBlog.forEach(post => {
|
||||||
|
const url = blogRootURL + "/" + post.path;
|
||||||
|
let content = "";
|
||||||
|
let contentArr = post.content.split("<!--truncate-->");
|
||||||
|
if (contentArr.length > 0) {
|
||||||
|
content = contentArr[0];
|
||||||
|
}
|
||||||
|
content = content.trim().substring(0, 250);
|
||||||
|
|
||||||
|
feed.addItem({
|
||||||
|
title: post.title,
|
||||||
|
link: url,
|
||||||
|
author: [
|
||||||
|
{
|
||||||
|
name: post.author,
|
||||||
|
link: post.authorURL
|
||||||
|
}
|
||||||
|
],
|
||||||
|
date: new Date(post.date),
|
||||||
|
description: content
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return type === "rss" ? feed.rss2() : feed.atom1();
|
||||||
|
};
|
|
@ -23,6 +23,8 @@ function execute() {
|
||||||
const translate = require("./translate.js");
|
const translate = require("./translate.js");
|
||||||
const versionFallback = require("./versionFallback.js");
|
const versionFallback = require("./versionFallback.js");
|
||||||
|
|
||||||
|
const feed = require("./feed.js");
|
||||||
|
|
||||||
const ENABLE_TRANSLATION = fs.existsSync(CWD + "/languages.js");
|
const ENABLE_TRANSLATION = fs.existsSync(CWD + "/languages.js");
|
||||||
const ENABLE_VERSIONING = fs.existsSync(CWD + "/versions.json");
|
const ENABLE_VERSIONING = fs.existsSync(CWD + "/versions.json");
|
||||||
|
|
||||||
|
@ -225,11 +227,11 @@ function execute() {
|
||||||
.replace(/\./g, "-")
|
.replace(/\./g, "-")
|
||||||
.replace(/\-md$/, ".html");
|
.replace(/\-md$/, ".html");
|
||||||
const result = readMetadata.extractMetadata(
|
const result = readMetadata.extractMetadata(
|
||||||
fs.readFileSync(file, { encoding: "utf8" })
|
fs.readFileSync(file, {encoding: "utf8"})
|
||||||
);
|
);
|
||||||
const rawContent = result.rawContent;
|
const rawContent = result.rawContent;
|
||||||
const metadata = Object.assign(
|
const metadata = Object.assign(
|
||||||
{ path: filePath, content: rawContent },
|
{path: filePath, content: rawContent},
|
||||||
result.metadata
|
result.metadata
|
||||||
);
|
);
|
||||||
metadata.id = metadata.title;
|
metadata.id = metadata.title;
|
||||||
|
@ -255,7 +257,7 @@ function execute() {
|
||||||
const perPage = 10;
|
const perPage = 10;
|
||||||
for (let page = 0; page < Math.ceil(MetadataBlog.length / perPage); page++) {
|
for (let page = 0; page < Math.ceil(MetadataBlog.length / perPage); page++) {
|
||||||
let language = "en";
|
let language = "en";
|
||||||
const metadata = { page: page, perPage: perPage };
|
const metadata = {page: page, perPage: perPage};
|
||||||
const blogPageComp = (
|
const blogPageComp = (
|
||||||
<BlogPageLayout
|
<BlogPageLayout
|
||||||
metadata={metadata}
|
metadata={metadata}
|
||||||
|
@ -274,6 +276,15 @@ function execute() {
|
||||||
"/index.html";
|
"/index.html";
|
||||||
writeFileAndCreateFolder(targetFile, str);
|
writeFileAndCreateFolder(targetFile, str);
|
||||||
}
|
}
|
||||||
|
// create rss files for all blog pages, if there are any blog files
|
||||||
|
if (MetadataBlog.length > 0) {
|
||||||
|
let targetFile =
|
||||||
|
CWD + "/build/" + siteConfig.projectName + "/blog/" + "feed.xml";
|
||||||
|
writeFileAndCreateFolder(targetFile, feed());
|
||||||
|
targetFile =
|
||||||
|
CWD + "/build/" + siteConfig.projectName + "/blog/" + "atom.xml";
|
||||||
|
writeFileAndCreateFolder(targetFile, feed("atom"));
|
||||||
|
}
|
||||||
|
|
||||||
// copy blog assets if they exist
|
// copy blog assets if they exist
|
||||||
if (fs.existsSync(CWD + "/blog/assets")) {
|
if (fs.existsSync(CWD + "/blog/assets")) {
|
||||||
|
|
|
@ -92,7 +92,7 @@ function extractMetadata(content) {
|
||||||
const both = splitHeader(content);
|
const both = splitHeader(content);
|
||||||
// if no content returned, then that means there was no header, and both.header is the content
|
// if no content returned, then that means there was no header, and both.header is the content
|
||||||
if (!both.content) {
|
if (!both.content) {
|
||||||
return { metadata, rawContent: both.header };
|
return {metadata, rawContent: both.header};
|
||||||
}
|
}
|
||||||
const lines = both.header.split("\n");
|
const lines = both.header.split("\n");
|
||||||
for (let i = 0; i < lines.length - 1; ++i) {
|
for (let i = 0; i < lines.length - 1; ++i) {
|
||||||
|
@ -104,7 +104,7 @@ function extractMetadata(content) {
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
metadata[key] = value;
|
metadata[key] = value;
|
||||||
}
|
}
|
||||||
return { metadata, rawContent: both.content };
|
return {metadata, rawContent: both.content};
|
||||||
}
|
}
|
||||||
|
|
||||||
// process the metadata for a document found in the docs folder
|
// process the metadata for a document found in the docs folder
|
||||||
|
@ -173,7 +173,7 @@ function processMetadata(file) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return { metadata, rawContent: rawContent };
|
return {metadata, rawContent: rawContent};
|
||||||
}
|
}
|
||||||
|
|
||||||
// process metadata for all docs and save into core/metadata.js
|
// process metadata for all docs and save into core/metadata.js
|
||||||
|
@ -295,13 +295,26 @@ function generateBlogMetadata() {
|
||||||
.replace("-", "/")
|
.replace("-", "/")
|
||||||
.replace(/\./g, "-")
|
.replace(/\./g, "-")
|
||||||
.replace(/\-md$/, ".html");
|
.replace(/\-md$/, ".html");
|
||||||
const result = extractMetadata(fs.readFileSync(file, { encoding: "utf8" }));
|
const result = extractMetadata(fs.readFileSync(file, {encoding: "utf8"}));
|
||||||
const rawContent = result.rawContent;
|
const rawContent = result.rawContent;
|
||||||
const metadata = Object.assign(
|
const metadata = Object.assign(
|
||||||
{ path: filePath, content: rawContent },
|
{path: filePath, content: rawContent},
|
||||||
result.metadata
|
result.metadata
|
||||||
);
|
);
|
||||||
|
|
||||||
metadata.id = metadata.title;
|
metadata.id = metadata.title;
|
||||||
|
|
||||||
|
// Extract, YYYY, MM, DD from the file name
|
||||||
|
let filePathDateArr = path.basename(file).toString().split("-");
|
||||||
|
metadata.date = new Date(
|
||||||
|
filePathDateArr[0] +
|
||||||
|
"-" +
|
||||||
|
filePathDateArr[1] +
|
||||||
|
"-" +
|
||||||
|
filePathDateArr[2] +
|
||||||
|
"T06:00:00.000Z"
|
||||||
|
);
|
||||||
|
|
||||||
metadatas.push(metadata);
|
metadatas.push(metadata);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@ function execute(port) {
|
||||||
const translate = require("./translate.js");
|
const translate = require("./translate.js");
|
||||||
const versionFallback = require("./versionFallback");
|
const versionFallback = require("./versionFallback");
|
||||||
|
|
||||||
|
const feed = require("./feed.js");
|
||||||
|
|
||||||
const CWD = process.cwd();
|
const CWD = process.cwd();
|
||||||
const ENABLE_TRANSLATION = fs.existsSync(CWD + "/languages.js");
|
const ENABLE_TRANSLATION = fs.existsSync(CWD + "/languages.js");
|
||||||
const ENABLE_VERSIONING = fs.existsSync(CWD + "/versions.json");
|
const ENABLE_VERSIONING = fs.existsSync(CWD + "/versions.json");
|
||||||
|
@ -219,6 +221,16 @@ function execute(port) {
|
||||||
res.send(renderToStaticMarkup(docComp));
|
res.send(renderToStaticMarkup(docComp));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.get(/blog\/.*xml$/, (req, res) => {
|
||||||
|
res.set("Content-Type", "application/rss+xml");
|
||||||
|
let parts = req.path.toString().split("blog/");
|
||||||
|
if (parts[1].toLowerCase() == "atom.xml") {
|
||||||
|
res.send(feed("atom"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
res.send(feed("rss"));
|
||||||
|
});
|
||||||
|
|
||||||
// handle all requests for blog pages and posts
|
// handle all requests for blog pages and posts
|
||||||
app.get(/blog\/.*html$/, (req, res) => {
|
app.get(/blog\/.*html$/, (req, res) => {
|
||||||
removeFromCache(CWD + "/siteConfig.js");
|
removeFromCache(CWD + "/siteConfig.js");
|
||||||
|
@ -242,7 +254,7 @@ function execute(port) {
|
||||||
page++
|
page++
|
||||||
) {
|
) {
|
||||||
let language = "en";
|
let language = "en";
|
||||||
const metadata = { page: page, perPage: perPage };
|
const metadata = {page: page, perPage: perPage};
|
||||||
const blogPageComp = (
|
const blogPageComp = (
|
||||||
<BlogPageLayout
|
<BlogPageLayout
|
||||||
metadata={metadata}
|
metadata={metadata}
|
||||||
|
@ -276,7 +288,7 @@ function execute(port) {
|
||||||
file = CWD + "/blog/" + file;
|
file = CWD + "/blog/" + file;
|
||||||
|
|
||||||
const result = readMetadata.extractMetadata(
|
const result = readMetadata.extractMetadata(
|
||||||
fs.readFileSync(file, { encoding: "utf8" })
|
fs.readFileSync(file, {encoding: "utf8"})
|
||||||
);
|
);
|
||||||
let rawContent = result.rawContent;
|
let rawContent = result.rawContent;
|
||||||
rawContent = rawContent.replace(
|
rawContent = rawContent.replace(
|
||||||
|
@ -284,7 +296,7 @@ function execute(port) {
|
||||||
"](" + siteConfig.baseUrl + "blog/assets/"
|
"](" + siteConfig.baseUrl + "blog/assets/"
|
||||||
);
|
);
|
||||||
const metadata = Object.assign(
|
const metadata = Object.assign(
|
||||||
{ path: req.path.toString().split("blog/")[1], content: rawContent },
|
{path: req.path.toString().split("blog/")[1], content: rawContent},
|
||||||
result.metadata
|
result.metadata
|
||||||
);
|
);
|
||||||
metadata.id = metadata.title;
|
metadata.id = metadata.title;
|
||||||
|
@ -323,7 +335,7 @@ function execute(port) {
|
||||||
))
|
))
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
res.send(fs.readFileSync(htmlFile, { encoding: "utf8" }));
|
res.send(fs.readFileSync(htmlFile, {encoding: "utf8"}));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,7 +411,7 @@ function execute(port) {
|
||||||
__dirname +
|
__dirname +
|
||||||
"/../static/" +
|
"/../static/" +
|
||||||
req.path.toString().replace(siteConfig.baseUrl, "/");
|
req.path.toString().replace(siteConfig.baseUrl, "/");
|
||||||
let cssContent = fs.readFileSync(mainCssPath, { encoding: "utf8" });
|
let cssContent = fs.readFileSync(mainCssPath, {encoding: "utf8"});
|
||||||
|
|
||||||
let files = glob.sync(CWD + "/static/**/*.css");
|
let files = glob.sync(CWD + "/static/**/*.css");
|
||||||
|
|
||||||
|
@ -408,7 +420,7 @@ function execute(port) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cssContent =
|
cssContent =
|
||||||
cssContent + "\n" + fs.readFileSync(file, { encoding: "utf8" });
|
cssContent + "\n" + fs.readFileSync(file, {encoding: "utf8"});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
"commander": "^2.11.0",
|
"commander": "^2.11.0",
|
||||||
"diff": "^3.3.0",
|
"diff": "^3.3.0",
|
||||||
"express": "^4.15.3",
|
"express": "^4.15.3",
|
||||||
|
"feed": "^1.1.0",
|
||||||
"fs-extra": "^3.0.1",
|
"fs-extra": "^3.0.1",
|
||||||
"glob": "^7.1.2",
|
"glob": "^7.1.2",
|
||||||
"prettier": "^1.5.3",
|
"prettier": "^1.5.3",
|
||||||
|
@ -25,6 +26,9 @@
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/facebookexperimental/Docusaurus.git"
|
"url": "https://github.com/facebookexperimental/Docusaurus.git"
|
||||||
},
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"jest": "^21.2.0"
|
||||||
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"docusaurus-start": "./lib/start-server.js",
|
"docusaurus-start": "./lib/start-server.js",
|
||||||
"docusaurus-build": "./lib/build-files.js",
|
"docusaurus-build": "./lib/build-files.js",
|
||||||
|
@ -32,6 +36,7 @@
|
||||||
"docusaurus-examples": "./lib/copy-examples.js",
|
"docusaurus-examples": "./lib/copy-examples.js",
|
||||||
"docusaurus-write-translations": "./lib/write-translations.js",
|
"docusaurus-write-translations": "./lib/write-translations.js",
|
||||||
"docusaurus-version": "./lib/version.js",
|
"docusaurus-version": "./lib/version.js",
|
||||||
"docusaurus-rename-version": "./lib/rename-version.js"
|
"docusaurus-rename-version": "./lib/rename-version.js",
|
||||||
|
"docusaurus-feed": "./lib/generate-feed.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
11
website/blog/2017-09-25-testing-rss.md
Normal file
11
website/blog/2017-09-25-testing-rss.md
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
title: Adding RSS Support
|
||||||
|
author: Eric Nakagawa
|
||||||
|
authorURL: http://twitter.com/ericnakagawa
|
||||||
|
authorFBID: ericnakagawa
|
||||||
|
---
|
||||||
|
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||||
|
|
||||||
|
This should be truncated.
|
||||||
|
<!--truncate-->
|
||||||
|
This line should never render in XML.
|
12
website/blog/2017-09-26-adding-rss.md
Normal file
12
website/blog/2017-09-26-adding-rss.md
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
---
|
||||||
|
title: Adding RSS Support
|
||||||
|
author: Eric Nakagawa
|
||||||
|
authorURL: http://twitter.com/ericnakagawa
|
||||||
|
authorFBID: ericnakagawa
|
||||||
|
---
|
||||||
|
|
||||||
|
This is a test post.
|
||||||
|
|
||||||
|
<!--truncate-->
|
||||||
|
|
||||||
|
A whole bunch of other information.
|
|
@ -11,7 +11,6 @@ const React = require("react");
|
||||||
|
|
||||||
class Footer extends React.Component {
|
class Footer extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
const currentYear = new Date().getFullYear();
|
|
||||||
return (
|
return (
|
||||||
<footer className="nav-footer" id="footer">
|
<footer className="nav-footer" id="footer">
|
||||||
<section className="sitemap">
|
<section className="sitemap">
|
||||||
|
@ -74,7 +73,9 @@ class Footer extends React.Component {
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
<section className="copyright">
|
<section className="copyright">
|
||||||
Copyright © {currentYear} Facebook Inc.
|
{this.props.config.copyright && (
|
||||||
|
<span>{this.props.config.copyright}</span>
|
||||||
|
)}
|
||||||
</section>
|
</section>
|
||||||
</footer>
|
</footer>
|
||||||
);
|
);
|
||||||
|
|
|
@ -9,5 +9,8 @@
|
||||||
"rename-version": "../lib/rename-version.js",
|
"rename-version": "../lib/rename-version.js",
|
||||||
"crowdin-upload": "crowdin-cli --config ../crowdin.yaml upload sources --auto-update -b master",
|
"crowdin-upload": "crowdin-cli --config ../crowdin.yaml upload sources --auto-update -b master",
|
||||||
"crowdin-download": "crowdin-cli --config ../crowdin.yaml download -b master"
|
"crowdin-download": "crowdin-cli --config ../crowdin.yaml download -b master"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"docusaurus": "^1.0.0-alpha.35"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,10 +40,10 @@ const siteConfig = {
|
||||||
editUrl:
|
editUrl:
|
||||||
"https://github.com/facebookexperimental/docusaurus/edit/master/docs/",
|
"https://github.com/facebookexperimental/docusaurus/edit/master/docs/",
|
||||||
headerLinks: [
|
headerLinks: [
|
||||||
{ doc: "installation", label: "Docs" },
|
{doc: "installation", label: "Docs"},
|
||||||
{ page: "help", label: "Help" },
|
{page: "help", label: "Help"},
|
||||||
{ blog: true, label: "Blog" },
|
{blog: true, label: "Blog"},
|
||||||
{ languages: false },
|
{languages: false},
|
||||||
{
|
{
|
||||||
href: "https://github.com/facebookexperimental/docusaurus",
|
href: "https://github.com/facebookexperimental/docusaurus",
|
||||||
label: "GitHub"
|
label: "GitHub"
|
||||||
|
@ -53,7 +53,6 @@ const siteConfig = {
|
||||||
footerIcon: "img/docusaurus_monochrome.svg",
|
footerIcon: "img/docusaurus_monochrome.svg",
|
||||||
favicon: "img/docusaurus.ico",
|
favicon: "img/docusaurus.ico",
|
||||||
// See https://docusaurus.io/docs/search for more information about Aloglia
|
// See https://docusaurus.io/docs/search for more information about Aloglia
|
||||||
// search
|
|
||||||
algolia: {
|
algolia: {
|
||||||
apiKey: "3eb9507824b8be89e7a199ecaa1a9d2c",
|
apiKey: "3eb9507824b8be89e7a199ecaa1a9d2c",
|
||||||
indexName: "docusaurus"
|
indexName: "docusaurus"
|
||||||
|
@ -62,7 +61,8 @@ const siteConfig = {
|
||||||
primaryColor: "#2E8555",
|
primaryColor: "#2E8555",
|
||||||
secondaryColor: "#205C3B",
|
secondaryColor: "#205C3B",
|
||||||
prismColor: "rgba(46, 133, 85, 0.03)"
|
prismColor: "rgba(46, 133, 85, 0.03)"
|
||||||
}
|
},
|
||||||
|
copyright: "Copyright © " + new Date().getFullYear() + " Facebook Inc."
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = siteConfig;
|
module.exports = siteConfig;
|
||||||
|
|
Loading…
Add table
Reference in a new issue