Skip to content

Commit

Permalink
docs: PSJekyll.Template.IncludeGoogleFont ( Fixes #59 )
Browse files Browse the repository at this point in the history
Renaming and allowing page fonts
  • Loading branch information
James Brundage committed Oct 9, 2024
1 parent ab71b4c commit be8ed72
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,31 @@
.DESCRIPTION
Includes a Google Font in the site.
This will add a link to the Google Font. It should be located in the head of the site.
This will add a link to the Google Font.
It can be located within the site or page front matter.
#>

param(
# The name of the font to include.
# If no value is directly provided, it will attempt to find a value in site.googleFont.
# If no font is found, it will default to Roboto.
[string]
$FontName,

# The code font to include.
# If no code font is provided, it will default to Roboto Mono.
[string]
$CodeFont
)
@(
if ($FontName) {
"<link href='https://fonts.googleapis.com/css?family=$fontName' rel='stylesheet'>"
} else {
"{% if site.googleFont %}"
"{% if page.googleFont %}"
"<link href='https://fonts.googleapis.com/css?family={{page.googleFont}}' rel='stylesheet'>"
"<style type='text/css'>body { font-family: '{{page.googleFont}}',sans-serif } </style>"
"{% elsif site.googleFont %}"
"<link href='https://fonts.googleapis.com/css?family={{site.googleFont}}' rel='stylesheet'>"
"<style type='text/css'>body { font-family: '{{site.googleFont}}',sans-serif } </style>"
"{% else %}"
Expand All @@ -31,7 +40,10 @@ if ($FontName) {
if ($CodeFont) {
"<link href='https://fonts.googleapis.com/css?family=$CodeFont' rel='stylesheet'>"
} else {
"{% if site.codeFont %}"
"{% if page.codeFont %}"
"<link href='https://fonts.googleapis.com/css?family={{page.codeFont}}' rel='stylesheet'>"
"<style type='text/css'>code, pre { font-family: '{{page.codeFont}}',monospace } </style>"
"{% elsif site.codeFont %}"
"<link href='https://fonts.googleapis.com/css?family={{site.codeFont}}' rel='stylesheet'>"
"<style type='text/css'>code, pre { font-family: '{{site.codeFont}}',monospace } </style>"
"{% else %}"
Expand Down

0 comments on commit be8ed72

Please sign in to comment.