Adds sitemap.xml. Adds 'Help Translate' to translatable strings. Error messages and fn name cleanups. (#136)

* added a note about needing more than one language to be enabled to allow for a drop down

* Removing debug statements

* Add 'Help Translate' to translatable strings, improves error messages around missing translated strings, calls write-translations on some routes

* Adds sitemap.xml to live server and build. Versioning not supported. -- Also did some file name and module cache cleanups.
This commit is contained in:
Eric Nakagawa 2017-10-18 12:55:58 -07:00 committed by Joel Marcey
parent 30eea17a24
commit bcba05ae03
19 changed files with 495 additions and 245 deletions

View file

@ -31,6 +31,7 @@ class Site extends React.Component {
this.props.config.baseUrl +
(this.props.url || "index.html");
let latestVersion;
if (fs.existsSync(CWD + "/versions.json")) {
latestVersion = require(CWD + "/versions.json")[0];
}
@ -54,12 +55,13 @@ class Site extends React.Component {
{this.props.children}
<Footer config={this.props.config} language={this.props.language} />
</div>
{this.props.config.algolia &&
{this.props.config.algolia && (
<script
type="text/javascript"
src="//cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"
/>}
{this.props.config.gaTrackingId &&
/>
)}
{this.props.config.gaTrackingId && (
<script
dangerouslySetInnerHTML={{
__html: `
@ -72,51 +74,56 @@ class Site extends React.Component {
ga('send', 'pageview');
`
}}
/>}
{this.props.config.facebookAppId &&
/>
)}
{this.props.config.facebookAppId && (
<script
dangerouslySetInnerHTML={{
__html: `window.fbAsyncInit = function() {FB.init({appId:'${this.props.config.facebookAppId}',xfbml:true,version:'v2.7'});};(function(d, s, id){var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) {return;}js = d.createElement(s); js.id = id;js.src = '//connect.facebook.net/en_US/sdk.js';fjs.parentNode.insertBefore(js, fjs);}(document, 'script','facebook-jssdk'));
`,
__html: `window.fbAsyncInit = function() {FB.init({appId:'${this
.props.config
.facebookAppId}',xfbml:true,version:'v2.7'});};(function(d, s, id){var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) {return;}js = d.createElement(s); js.id = id;js.src = '//connect.facebook.net/en_US/sdk.js';fjs.parentNode.insertBefore(js, fjs);}(document, 'script','facebook-jssdk'));
`
}}
/>
}
{this.props.config.twitter &&
)}
{this.props.config.twitter && (
<script
dangerouslySetInnerHTML={{
__html: `window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter-wjs'));`,
__html: `window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter-wjs'));`
}}
/>
}
)}
{this.props.config.algolia &&
(this.props.config.algolia.algoliaOptions
? <script
dangerouslySetInnerHTML={{
__html: `
(this.props.config.algolia.algoliaOptions ? (
<script
dangerouslySetInnerHTML={{
__html: `
var search = docsearch({
apiKey: '${this.props.config.algolia.apiKey}',
indexName: '${this.props.config.algolia.indexName}',
inputSelector: '#search_input_react',
algoliaOptions: ${
JSON.stringify(this.props.config.algolia.algoliaOptions)
algoliaOptions: ${JSON.stringify(
this.props.config.algolia.algoliaOptions
)
.replace("VERSION", this.props.version || latestVersion)
.replace("LANGUAGE", this.props.language)
}
.replace("LANGUAGE", this.props.language)}
});
`
}}
/>
: <script
dangerouslySetInnerHTML={{
__html: `
}}
/>
) : (
<script
dangerouslySetInnerHTML={{
__html: `
var search = docsearch({
apiKey: '${this.props.config.algolia.apiKey}',
indexName: '${this.props.config.algolia.indexName}',
inputSelector: '#search_input_react'
});
`
}}
/>)}
}}
/>
))}
</body>
</html>
);