function injectHeader(initialContents, title, isLocal) {
  const baseURL = isLocal ? '/' : '/blockly-samples/';

  const headerAdditions = `
  <!-- INJECTED HEADER -->
  <meta name="viewport" content="width=device-width,maximum-scale=2">
  <link rel="icon" type="image/x-icon" href="${baseURL}favicon.ico" />
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:400,300,300italic,400italic,500,500italic,700,700italic" />
  <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
  <link rel="stylesheet" href="https://blocklycodelabs.dev/styles/main.css" />
  <link rel="stylesheet" href="${baseURL}css/custom.css"/>
  <!-- END INJECTED HEADER -->`;

  // Replace the title with a more descriptive title.
  let modifiedContents = initialContents.replace(
    /<title>.*<\/title>/,
    `<title>${title}</title>`,
  );
  // Add some CSS at the beginning of the header. Any CSS the page already
  // had will be higher priority.
  modifiedContents = modifiedContents.replace(
    /<\s*head\s*>/,
    `<head>${headerAdditions}`,
  );
  return modifiedContents;
}
Inject head HTML for a plugin or example page on gh-pages.
@param {string} initialContents The initial page HTML, as a string.
@param {string} title The title to use for the page, which may be
    generated from the package name or specified explicitly.
@param {boolean} isLocal True if building for a local test. False
    if building for gh-pages.
@returns {string} The modified contents of the page, as a string.