Skip to content

Commit

Permalink
added schema
Browse files Browse the repository at this point in the history
  • Loading branch information
vachan-maker committed May 4, 2024
1 parent f5e268f commit 5c43711
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 19 deletions.
1 change: 1 addition & 0 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ baseURL = 'https://vachan.me'
[params]
user = "vachan"
images = ['/images/site-feature-image.png']
copyright = "All work licensed under CC BY-SA 4.0 unless otherwise stated."
description = "Hey there! I am Vachan and I love thinkering with computers. I am currently pursuing Computer Science and Engineering. You can read my posts, know more about me and get in touch with me"
[params.author]
name = "Vachan S Panicker"
Expand Down
34 changes: 17 additions & 17 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{{ define "title"}}
{{ .Title }} | {{ .Site.Params.author.name }}
{{ .Title }} | {{ .Site.Params.author.name }}
{{ end }}
{{ define "main" }}
{{ $date := .Date.Format "02.01.2006" }}
{{ $lastmod := .Lastmod.Format "02.01.2006" }}
<article>
<h1 class = "postTitle">{{ .Title }}</h1>
{{ if .Description }}
<p>{{ .Description }}</p>
{{ end }}
<p class="postMeta"><strong>Posted On:</strong> {{ .Date.Format "Mon Jan 2, 2006" }} </p>
<hr />
{{ .Content }}
{{ if ne $lastmod $date }}
<em>Last Updated On: {{ .Lastmod.Format "Mon Jan 2, 2006" }}</em>
{{ end }}
</article>
<p><a href = "mailto: {{ .Site.Params.author.email }}?subject={{ .Title }}&body=post-link:{{ .Permalink }}">Comment via Email</p>
<p><a href = "/index.xml">RSS Feed</a></p>
{{ $date := .Date.Format "02.01.2006" }}
{{ $lastmod := .Lastmod.Format "02.01.2006" }}
<article>
<h1 class = "postTitle">{{ .Title }}</h1>
{{ if .Description }}
<p>{{ .Description }}</p>
{{ end }}
<p class="postMeta"><strong>Posted On:</strong> {{ .Date.Format "Mon Jan 2, 2006" }} </p>
<hr />
{{ .Content }}
{{ if ne $lastmod $date }}
<em>Last Updated On: {{ .Lastmod.Format "Mon Jan 2, 2006" }}</em>
{{ end }}
</article>
<p><a href = "mailto: {{ .Site.Params.author.email }}?subject={{ .Title }}&body=post-link:{{ .Permalink }}">Comment via Email</p>
<p><a href = "/index.xml">RSS Feed</a></p>
{{ end }}
2 changes: 1 addition & 1 deletion layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
{{ $style := resources.Get "sass/main.scss" | toCSS $options | minify | fingerprint }}
<link href="{{ $style.RelPermalink }}" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/confetti.browser.min.js"></script>

{{ partial "schema.html" . }}
2 changes: 1 addition & 1 deletion layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h1 class = "logo" lang = "ml">വചൻ</h1>
<li onclick="confetti({
spread: 180,
particleCount: 200
});"><a>🥳</a></li>
});">🥳</li>
</ul>
</nav>
</header>
51 changes: 51 additions & 0 deletions layouts/partials/schema.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{ if .IsHome -}}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "website",
"name": "{{ .Site.Title }}",
"url": "{{ .Site.BaseURL }}",
"description": "{{ .Site.Params.description }}",
"thumbnailUrl": "{{ .Site.Params.Logo | absURL }}",
"license": "{{ .Site.Params.Copyright }}"
}
</script>
{{ else if .IsPage }}
{{ $author := or (.Params.author) (.Site.Author.name) }}
{{ $org_name := .Site.Title }}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "article",
"articleSection": "{{ .Section }}",
"name": "{{ .Title | safeJS }}",
"headline": "{{ .Title | safeJS }}",
"alternativeHeadline": "{{ .Params.lead }}",
"description": "{{ if .Description }}{{ .Description | safeJS }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }}",
"inLanguage": {{ .Site.LanguageCode | default "en-us" }},
"isFamilyFriendly": "true",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "{{ .Permalink }}"
},
"author" : {
"@type": "Person",
"name": "{{ .Site.Params.author.name }}"
},
"creator" : {
"@type": "Person",
"name": "{{ .Site.Params.author.name }}"
},
"accountablePerson" : {
"@type": "Person",
"name": "{{ .Site.Params.author.name }}"
},
"dateCreated": "{{ .Date.Format "2006-01-02T15:04:05.00Z" | safeHTML }}",
"datePublished": "{{ .PublishDate.Format "2006-01-02T15:04:05.00Z" | safeHTML }}",
"dateModified": "{{ .Lastmod.Format "2006-01-02T15:04:05.00Z" | safeHTML }}",
"image": {{ if .Params.images }}[{{ range $i, $e := .Params.images }}{{ if $i }}, {{ end }}{{ $e | absURL }}{{ end }}]{{ else}}{{ .Site.Params.images| absURL }}{{ end }},
"url" : "{{ .Permalink }}",
"wordCount" : "{{ .WordCount }}",
}
</script>
{{ end }}

0 comments on commit 5c43711

Please sign in to comment.