Skip to content

Commit

Permalink
Merge branch 'master' into fix_path_thumbnail_images
Browse files Browse the repository at this point in the history
  • Loading branch information
chipzoller authored Sep 23, 2024
2 parents 87f97e9 + a21df4d commit 7148473
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 21 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ These options set global values that some pages or all pages in the site use by
| showRelatedInSidebar | boolean | no |
| footerLogo | string | N/A |
| enableSearch | boolean | N/A |
| blogDir | string | no |

### Page Parameters

Expand Down Expand Up @@ -844,13 +845,13 @@ mkdir -p layouts/partials && cp themes/clarity/layouts/partials/math.html layout
Then add the corresponding line as its [README](https://github.com/KaTeX/KaTeX/tree/master/contrib/mhchem) suggested (without the `+` sign):

```diff
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css" integrity_no="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" integrity_no="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X" crossorigin="anonymous">

<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js" integrity_no="sha384-g7c+Jr9ZivxKLnZTDUhnkOnsh30B4H0rpLUpJ4jAIKs4fnJI+sEnkvrMWph2EDg4" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js" integrity_no="sha384-nB0miv6/jRmo5UMMR1wu3Gz6NLsoTkbqJghGIsx//Rlm+ZU03BU6SQNC66uf4l5+" crossorigin="anonymous"></script>

+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/mhchem.min.js" integrity_no="sha384-5gCAXJ0ZgozlShOzzT0OWArn7yCPGWVIvgo+BAd8NUKbCmulrJiQuCVR9cHlPHeG" crossorigin="anonymous"></script>
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/mhchem.min.js" integrity_no="sha384-ifpG+NlgMq0kvOSGqGQxW1mJKpjjMDmZdpKGq3tbvD3WPhyshCEEYClriK/wRVU0" crossorigin="anonymous"></script>

<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js" integrity_no="sha384-mll67QQFJfxn0IYznZYonOWZ644AWYC+Pt2cHqMaRhXVrursRwvLnLaebdGIlYNa" crossorigin="anonymous"
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js" integrity_no="sha384-43gviWU0YVjaDtb/GhzOouOXtZMP/7XUzwPTstBeZFe/+rCMvRwr4yROQP43s0Xk" crossorigin="anonymous"
onload="renderMathInElement(document.body);"></script>
```

Expand Down
3 changes: 2 additions & 1 deletion exampleSite/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
public/
resources/
resources/
.hugo_build.lock
3 changes: 3 additions & 0 deletions exampleSite/config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ languageMenuName = "🌐"
# Enable or disable comments globally. Default to true.
# comments = false

# Activate meta ld+json for blog
blogDir = "post"

# Enable or disable Utterances (https://github.com/utterance/utterances) Github Issue-Based Commenting
# utterances = true # Run the utterances script in the single.html layout to load https://utteranc.es comments
# utterancesRepo = "GHUsername/Repository.Name" # Utterances is enabled when this param is set
Expand Down
15 changes: 7 additions & 8 deletions exampleSite/content/post/math-typesetting.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,26 @@ Mathematical notation in a Hugo project can be enabled by using third party Java

In this example we will be using [KaTeX](https://katex.org/)

- Create a partial under `/layouts/partials/math.html`
- Within this partial reference the [Auto-render Extension](https://katex.org/docs/autorender.html) or host these scripts locally.
- Include the partial in your templates like so:
- Create a partial under `/layouts/partials/hooks/head-end.html`
- Add these lines to the newly created partial:

```bash
{{ if or .Params.math .Site.Params.math }}
{{ partial "math.html" . }}
{{ end }}
```
- To enable KaTex globally set the parameter `math` to `true` in a project's configuration
- To enable KaTex on a per page basis include the parameter `math: true` in content files
- To enable KaTeX globally set the parameter `math` to `true` in a project's configuration
- To enable KaTeX on a per page basis include the parameter `math: true` in content files
**Note:** Use the online reference of [Supported TeX Functions](https://katex.org/docs/supported.html)
{{< math.inline >}}
{{ if or .Page.Params.math .Site.Params.math }}
<!-- KaTeX -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css" integrity_no="sha384-zB1R0rpPzHqg7Kpt0Aljp8JPLqbXI3bhnPWROx27a9N0Ll6ZP/+DiW/UqRcLbRjq" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js" integrity_no="sha384-y23I5Q6l+B6vatafAwxRu/0oK/79VlbSz7Q9aiSZUvyWYIYsd+qj+o24G5ZU2zJz" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/contrib/auto-render.min.js" integrity_no="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" integrity_no="sha384-nB0miv6/jRmo5UMMR1wu3Gz6NLsoTkbqJghGIsx//Rlm+ZU03BU6SQNC66uf4l5+" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js" integrity_no="sha384-7zkQWkzuo3B5mTepMUcHkMB5jZaolc2xDwL6VFqjFALcbeS9Ggm/Yr2r3Dy4lfFg" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js" integrity_no="sha384-43gviWU0YVjaDtb/GhzOouOXtZMP/7XUzwPTstBeZFe/+rCMvRwr4yROQP43s0Xk" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>
{{ end }}
{{</ math.inline >}}
Expand Down
Empty file removed exampleSite/layouts/.gitkeep
Empty file.
3 changes: 3 additions & 0 deletions exampleSite/layouts/partials/hooks/head-end.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{ if or .Params.math .Site.Params.math }}
{{ partial "math.html" . }}
{{ end }}
6 changes: 3 additions & 3 deletions layouts/partials/math.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css" integrity="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js" integrity="sha384-g7c+Jr9ZivxKLnZTDUhnkOnsh30B4H0rpLUpJ4jAIKs4fnJI+sEnkvrMWph2EDg4" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js" integrity="sha384-mll67QQFJfxn0IYznZYonOWZ644AWYC+Pt2cHqMaRhXVrursRwvLnLaebdGIlYNa" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" integrity="sha512-aOFyMMzZF7l7ei3vOKgQiRhZnYqk9YC/uMzl4T0j5N5D3Kul+QAFU8ssENDRMAqr/lxDOjMF69dSYJ8HYqY+WQ==" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js" integrity="sha512-UPFOadao2nEorjtjl0xUTtN3w20Ja143UPEU6EyJ1mi5MB2bDtMkiWmqGDqi47xNLB5z1dy31GKJDEWhjUJFiQ==" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js" integrity="sha512-YJVxTjqttjsU3cSvaTRqsSl0wbRgZUNF+NGGCgto/MUbIvaLdXQzGTCQu4CvyJZbZctgflVB0PXw9LLmTWm5/w==" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>
40 changes: 35 additions & 5 deletions layouts/partials/opengraph.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,46 @@
<meta property="og:title" content="{{ $title }}" />
<meta property="og:description" content="{{ $summary }}" />
<meta property="og:image" content="{{ $image }}" />
{{- $keywords := "" }}
{{- $mergedKeywords := slice }}
{{- with $s.keywords }}
{{- $keywords = delimit $s.keywords "," }}
{{- range . }}
{{- $mergedKeywords = $mergedKeywords | append . }}
{{- end }}
{{- end }}
{{- with $p.keywords }}
{{- $keywords = delimit . "," }}
{{- range . }}
{{- $mergedKeywords = $mergedKeywords | append . }}
{{- end }}
{{- end }}
{{- with $s.tags }}
{{- range . }}
{{- $mergedKeywords = $mergedKeywords | append . }}
{{- end }}
{{- end }}
{{- with $keywords }}
<meta name="keywords" content="{{ $keywords }}" />
{{- with $p.tags }}
{{- range . }}
{{- $mergedKeywords = $mergedKeywords | append . }}
{{- end }}
{{- end }}
{{- $mergedKeywordsString := delimit $mergedKeywords "," }}
{{- with $mergedKeywordsString }}
<meta name="keywords" content="{{ $mergedKeywordsString }}" />
{{- end }}
{{- if eq .Section $s.blogDir -}}
{{- $date := ( .Date.Format "2006-02-01") -}}
{{- $date := (time .Date) }}
{{- $lastMod := (time .Lastmod) }}
{{- $categories := slice }}
{{- with $s.categories }}
{{- range . }}
{{- $categories = $categories | append . }}
{{- end }}
{{- end }}
{{- with $p.categories }}
{{- range . }}
{{- $categories = $categories | append . }}
{{- end }}
{{- end }}
<script type="application/ld+json">
{
"@context": "http://schema.org",
Expand All @@ -84,6 +110,10 @@
"url": "{{ $permalink }}",
"datePublished": {{ $date }},
"dateModified": {{ $lastMod }},
"keywords": {{ $mergedKeywords }},
{{- with $categories }}
"articleSection": {{ $categories }},
{{- end }}
"author": {
"@type": "Person",
"name": "{{ $author }}"
Expand Down

0 comments on commit 7148473

Please sign in to comment.