Skip to content

Commit 6e59b97

Browse files
committed
chore: Add footer to the conf.
1 parent 3f92923 commit 6e59b97

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

src/conf/path.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function getRdocConf() {
2525
return conf;
2626
}
2727

28-
function getCinfigFilePath(fileName, type) {
28+
function getConfigFilePath(fileName, type) {
2929
const conf = getRdocConf();
3030
// 这里是读取配置
3131
if (conf && conf[type]) {
@@ -55,21 +55,21 @@ function getCinfigFilePath(fileName, type) {
5555

5656
// Get favicon path
5757
const faviconPath = () => {
58-
const _path = getCinfigFilePath('./favicon.ico', 'favicon');
58+
const _path = getConfigFilePath('./favicon.ico', 'favicon');
5959
if (_path) return _path;
6060
return resolveTool('../../theme/default/favicon.ico');
6161
};
6262

6363
// Get logo path
6464
const logoPath = () => {
65-
const _path = getCinfigFilePath('./logo.svg', 'logo');
65+
const _path = getConfigFilePath('./logo.svg', 'logo');
6666
if (_path) return _path;
6767
return false;
6868
};
6969

7070
// Get theme path
7171
const getThemePath = () => {
72-
const _path = getCinfigFilePath('./default', 'theme');
72+
const _path = getConfigFilePath('./default', 'theme');
7373
if (_path) return _path;
7474
return resolveTool('../../theme/default');
7575
};

src/conf/webpack.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ const UPATH = require('upath');
55
const paths = require('./path');
66
const pkg = require('../../package.json');
77

8+
const define = paths.rdocConf && paths.rdocConf.footer && typeof paths.rdocConf.footer === 'string'
9+
? { FOOTER: JSON.stringify(paths.rdocConf.footer) } : {};
10+
811
module.exports = {
912
entry: {},
1013
output: {
@@ -91,6 +94,7 @@ module.exports = {
9194
new WebpackBar({ name: pkg.name }),
9295
new webpack.DefinePlugin({
9396
VERSION: JSON.stringify(pkg.version),
97+
...define,
9498
}),
9599
],
96100
node: {

templates/default/introduce/api/conf.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ sort: 4
2626
+ "theme": "rdoc-theme-load-react",
2727
+ "favicon": "./assets/favicon.ico",
2828
+ "logo": "./assets/rdoc.logo.svg",
29+
+ "footer": "前端<b>开</b>发"
2930
+ "react_modules": {
3031
+ "Hotkeys": "react-hot-keys"
3132
+ }
@@ -83,3 +84,7 @@ sort: 4
8384
这个参数是一个特定参数,需求是在制作主题的时候,你的主题需要预览 React 实例,实例还需要加载一些未知的第三方 React 组件,这个时候你需要在你的 Markdown 项目中安装你需要的 React 组件,在配置中指定你的组件,在预览实例中你就可以引用该组件了。
8485

8586
> ⚠️注意:还在研究实现方式。
87+
88+
### footer
89+
90+
更改文档网站页脚

theme/default/component/Footer/index.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,18 @@ import styles from './index.less';
33

44
const version = VERSION; // eslint-disable-line
55

6-
const Footer = () => {
6+
const footer = FOOTER; // eslint-disable-line
7+
8+
const FooterView = () => {
79
return (
810
<div className={styles.footer}>
9-
Copyright © 2018 Powered by <a target="_blank" rel="noopener noreferrer" href="https://github.com/jaywcjlove/rdoc">RDoc {version}</a>.
11+
{footer ? <div dangerouslySetInnerHTML={{ __html: footer }} /> : (
12+
<div>
13+
Copyright © 2018 Powered by <a target="_blank" rel="noopener noreferrer" href="https://github.com/jaywcjlove/rdoc">RDoc {version}</a>.
14+
</div>
15+
)}
1016
</div>
1117
);
1218
};
1319

14-
export default Footer;
20+
export default FooterView;

0 commit comments

Comments
 (0)