Add <doctype HTML> to HTML pages (#566)

* Add doctype to static rendering

* Set content-type for CSS
This commit is contained in:
Yangshun Tay 2018-04-15 15:50:43 -07:00 committed by GitHub
parent 0593ea0039
commit 946e2cef90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 23 deletions

21
lib/server/renderUtils.js Normal file
View file

@ -0,0 +1,21 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const renderToStaticMarkup = require('react-dom/server').renderToStaticMarkup;
/**
* Custom function that wraps renderToStaticMarkup so that we can inject
* doctype before React renders the contents. All instance of full-page
* rendering within Docusaurus should use this function instead.
*/
function renderToStaticMarkupWithDoctype(...args) {
return '<!DOCTYPE html>' + renderToStaticMarkup(...args);
}
module.exports = {
renderToStaticMarkupWithDoctype,
};