feat(fonts): allow PageTitle to have its own font subset (#1848)
* fix(explorer): vertically center the Explorer toggle under mobile view * Added a separate title font configuration * Added googleSubFontHref function * Applied --titleFont to PageTitle * Made googleFontHref return array of URLs * Dealing with empty and undefined title * Minor update * Dealing with empty and undefined title * Refined font inclusion logic * Adopted the googleFontHref + googleFontSubsetHref method * Adaptively include font subset for PageTitle * Restored default config * Minor changes on configuration docs * Formatted source code
This commit is contained in:
		@@ -1,7 +1,7 @@
 | 
			
		||||
import { i18n } from "../i18n"
 | 
			
		||||
import { FullSlug, getFileExtension, joinSegments, pathToRoot } from "../util/path"
 | 
			
		||||
import { CSSResourceToStyleElement, JSResourceToScriptElement } from "../util/resources"
 | 
			
		||||
import { googleFontHref } from "../util/theme"
 | 
			
		||||
import { googleFontHref, googleFontSubsetHref } from "../util/theme"
 | 
			
		||||
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
 | 
			
		||||
import { unescapeHTML } from "../util/escape"
 | 
			
		||||
import { CustomOgImagesEmitterName } from "../plugins/emitters/ogImage"
 | 
			
		||||
@@ -45,6 +45,9 @@ export default (() => {
 | 
			
		||||
            <link rel="preconnect" href="https://fonts.googleapis.com" />
 | 
			
		||||
            <link rel="preconnect" href="https://fonts.gstatic.com" />
 | 
			
		||||
            <link rel="stylesheet" href={googleFontHref(cfg.theme)} />
 | 
			
		||||
            {cfg.theme.typography.title && (
 | 
			
		||||
              <link rel="stylesheet" href={googleFontSubsetHref(cfg.theme, cfg.pageTitle)} />
 | 
			
		||||
            )}
 | 
			
		||||
          </>
 | 
			
		||||
        )}
 | 
			
		||||
        <link rel="preconnect" href="https://cdnjs.cloudflare.com" crossOrigin="anonymous" />
 | 
			
		||||
 
 | 
			
		||||
@@ -17,6 +17,7 @@ PageTitle.css = `
 | 
			
		||||
.page-title {
 | 
			
		||||
  font-size: 1.75rem;
 | 
			
		||||
  margin: 0;
 | 
			
		||||
  font-family: var(--titleFont);
 | 
			
		||||
}
 | 
			
		||||
`
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user