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
StartAutomating authored and StartAutomating committed Oct 9, 2024
1 parent be8ed72 commit 9f05e8f
Showing 1 changed file with 61 additions and 49 deletions.
110 changes: 61 additions & 49 deletions PSJekyll.types.ps1xml
Original file line number Diff line number Diff line change
Expand Up @@ -1247,6 +1247,67 @@ $RepositoryUrl
"@
</Script>
</ScriptMethod>
<ScriptMethod>
<Name>Include.GoogleFont.html</Name>
<Script>
&lt;#
.SYNOPSIS
Includes a Google Font.
.DESCRIPTION
Includes a Google Font in the site.

This will add a link to the Google Font.

It can be located within the site or page front matter.
#&gt;

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) {
"&lt;link href='https://fonts.googleapis.com/css?family=$fontName' rel='stylesheet'&gt;"
} else {
"{% if page.googleFont %}"
"&lt;link href='https://fonts.googleapis.com/css?family={{page.googleFont}}' rel='stylesheet'&gt;"
"&lt;style type='text/css'&gt;body { font-family: '{{page.googleFont}}',sans-serif } &lt;/style&gt;"
"{% elsif site.googleFont %}"
"&lt;link href='https://fonts.googleapis.com/css?family={{site.googleFont}}' rel='stylesheet'&gt;"
"&lt;style type='text/css'&gt;body { font-family: '{{site.googleFont}}',sans-serif } &lt;/style&gt;"
"{% else %}"
"&lt;link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet'&gt;"
"&lt;style type='text/css'&gt;body { font-family: 'Roboto',sans-serif } &lt;/style&gt;"
"{% endif %}"
}

if ($CodeFont) {
"&lt;link href='https://fonts.googleapis.com/css?family=$CodeFont' rel='stylesheet'&gt;"
} else {
"{% if page.codeFont %}"
"&lt;link href='https://fonts.googleapis.com/css?family={{page.codeFont}}' rel='stylesheet'&gt;"
"&lt;style type='text/css'&gt;code, pre { font-family: '{{page.codeFont}}',monospace } &lt;/style&gt;"
"{% elsif site.codeFont %}"
"&lt;link href='https://fonts.googleapis.com/css?family={{site.codeFont}}' rel='stylesheet'&gt;"
"&lt;style type='text/css'&gt;code, pre { font-family: '{{site.codeFont}}',monospace } &lt;/style&gt;"
"{% else %}"
"&lt;link href='https://fonts.googleapis.com/css?family=Roboto+Mono' rel='stylesheet'&gt;"
"&lt;style type='text/css'&gt;code, pre { font-family: 'Roboto Mono',monospace } &lt;/style&gt;"
"{% endif %}"
}
) -join [Environment]::Newline


</Script>
</ScriptMethod>
<ScriptMethod>
<Name>Include.Menu.html</Name>
<Script>
Expand Down Expand Up @@ -1438,55 +1499,6 @@ if ($footer) {
}
</Script>
</ScriptMethod>
<ScriptMethod>
<Name>IncludeGoogleFont</Name>
<Script>
&lt;#
.SYNOPSIS
Includes a Google Font.
.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.
#&gt;

param(
# The name of the font to include.
[string]
$FontName,

[string]
$CodeFont
)
@(
if ($FontName) {
"&lt;link href='https://fonts.googleapis.com/css?family=$fontName' rel='stylesheet'&gt;"
} else {
"{% if site.googleFont %}"
"&lt;link href='https://fonts.googleapis.com/css?family={{site.googleFont}}' rel='stylesheet'&gt;"
"&lt;style type='text/css'&gt;body { font-family: '{{site.googleFont}}',sans-serif } &lt;/style&gt;"
"{% else %}"
"&lt;link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet'&gt;"
"&lt;style type='text/css'&gt;body { font-family: 'Roboto',sans-serif } &lt;/style&gt;"
"{% endif %}"
}

if ($CodeFont) {
"&lt;link href='https://fonts.googleapis.com/css?family=$CodeFont' rel='stylesheet'&gt;"
} else {
"{% if site.codeFont %}"
"&lt;link href='https://fonts.googleapis.com/css?family={{site.codeFont}}' rel='stylesheet'&gt;"
"&lt;style type='text/css'&gt;code, pre { font-family: '{{site.codeFont}}',monospace } &lt;/style&gt;"
"{% else %}"
"&lt;link href='https://fonts.googleapis.com/css?family=Roboto+Mono' rel='stylesheet'&gt;"
"&lt;style type='text/css'&gt;code, pre { font-family: 'Roboto Mono',monospace } &lt;/style&gt;"
"{% endif %}"
}
) -join [Environment]::Newline


</Script>
</ScriptMethod>
<ScriptMethod>
<Name>IncludeImportMap</Name>
<Script>
Expand Down

0 comments on commit 9f05e8f

Please sign in to comment.