Skip to content

Commit

Permalink
Enable setting of title for custom pages
Browse files Browse the repository at this point in the history
* allowing custom title on page component

* Update about-slash.js

* Update help.js

* Update users.js

* Update versions.js
  • Loading branch information
endiliey authored and yangshun committed May 31, 2018
1 parent b3d59f8 commit 72f4f36
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/server/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ async function execute() {
<Site
language={language}
config={siteConfig}
title={ReactComp.title}
metadata={{id: pageID}}>
<ReactComp language={language} />
</Site>
Expand All @@ -513,7 +514,11 @@ async function execute() {
let language = env.translation.enabled ? 'en' : '';
translate.setLanguage(language);
const str = renderToStaticMarkupWithDoctype(
<Site language={language} config={siteConfig} metadata={{id: pageID}}>
<Site
title={ReactComp.title}
language={language}
config={siteConfig}
metadata={{id: pageID}}>
<ReactComp language={language} />
</Site>
);
Expand All @@ -526,7 +531,11 @@ async function execute() {
let language = env.translation.enabled ? 'en' : '';
translate.setLanguage(language);
const str = renderToStaticMarkupWithDoctype(
<Site language={language} config={siteConfig} metadata={{id: pageID}}>
<Site
title={ReactComp.title}
language={language}
config={siteConfig}
metadata={{id: pageID}}>
<ReactComp language={language} />
</Site>
);
Expand Down
1 change: 1 addition & 0 deletions lib/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ function execute(port) {
<Site
language={language}
config={siteConfig}
title={ReactComp.title}
metadata={{id: path.basename(userFile, '.js')}}>
<ReactComp language={language} />
</Site>
Expand Down
2 changes: 2 additions & 0 deletions website/pages/en/about-slash.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ AboutSlash.defaultProps = {
language: "en"
};

AboutSlash.title = 'About Slash';

module.exports = AboutSlash;
2 changes: 2 additions & 0 deletions website/pages/en/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,6 @@ class Help extends React.Component {
}
}

Help.title = 'Help';

module.exports = Help;
2 changes: 2 additions & 0 deletions website/pages/en/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,6 @@ class Users extends React.Component {
}
}

Users.title = 'Users';

module.exports = Users;
2 changes: 2 additions & 0 deletions website/pages/en/versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,6 @@ class Versions extends React.Component {
}
}

Versions.title = 'Versions';

module.exports = Versions;

0 comments on commit 72f4f36

Please sign in to comment.