~tristan957/tristan.partin.io

05eea24c6d1efd471a5e5a6f825a3b53854efdea — Tristan Partin 2 days ago 0a7b671
Use config params instead of hard-coding values everywhere
M config.toml => config.toml +48 -0
@@ 34,3 34,51 @@ disableHugoGeneratorInject = false
[pages]
  [pages.build]
    list = true

[author]
  name = "Tristan Partin"

[params]
  defaultDescription = "Tristan Partin's personal website and blog."
  webring = true
[params.licenses]
  [params.licenses.content]
    license = "CC-BY-SA-4.0"
    url = "https://creativecommons.org/licenses/by-sa/4.0/"
  [params.licenses.code]
    license = "AGPL-3.0"
    url = "https://opensource.org/licenses/AGPL-3.0"
[params.siteImage]
  resourcePath = "images/astronaut-on-the-moon-with-a-beer-looking-at-earth.jpg"
  alt = "An astronaut with a beer sitting in a lawn chair looking at the Earth from the Moon"
[params.repository]
  forge = "SourceHut"
  url = "https://sr.ht/~tristan957/tristan.partin.io"
  commitURLPattern = "https://git.sr.ht/~tristan957/tristan.partin.io/commit/%s"
[params.email]
  beforeAt = "tristan"
  afterAtBeforeDot = "partin"
  tld = "io"
[params.socials]
  [params.socials.sourceHut]
    username = "~tristan957"
    url = "https://git.sr.ht/~tristan957"
  [params.socials.gitHub]
    username = "tristan957"
    url = "https://github.com/tristan957"
  [params.socials.mastodon]
    username = "@tristan957@mastodon.social"
    url = "https://mastodon.social/@tristan957"
  [params.socials.linkedIn]
    username = "tristan-partin"
    url = "https://linkedin.com/in/tristan-partin"
[params.resume]
  url = "/documents/My_Resume.pdf"
[params.utterances]
  enabled = true
  repo = "tristan957/tristan.partin.io"
  issueTerm = "pathname"
  label = "comments"
[params.mailingList]
  address = "~tristan957/public-inbox@lists.sr.ht"
  archiveURL = "https://lists.sr.ht/~tristan957/public-inbox"

M layouts/_default/baseof.html => layouts/_default/baseof.html +3 -1
@@ 8,7 8,9 @@
			<main id="main">
				{{ block "main" . }}
				{{ end }}
				{{ partial "webring-out.html" }}
				{{ if .Site.Params.webring }}
					{{ partial "webring-out.html" }}
				{{ end }}
			</main>
			{{ partial "sidebar.html" . }}
		</div>

M layouts/_default/single.html => layouts/_default/single.html +75 -58
@@ 7,7 7,14 @@
          {{ with .Date.Format "2006-01-02" }}
            Published <time datetime="{{ . }}">{{ . }}</time> on
          {{ end }}
          <a class="content-metadata" href="/blog">Tristan Partin's blog</a>
          <a class="content-metadata" href="{{ (.GetPage "blog").RelPermalink }}">
            {{ if strings.HasSuffix .Site.Author.name "s" }}
              {{ .Site.Author.name }}'
            {{ else }}
              {{ .Site.Author.name }}'s
            {{ end }}
            blog
          </a>
          <a class="content-metadata" href="{{ .Permalink }}">Permalink</a>
          <br />


@@ 20,70 27,80 @@
      </div>
    </article>
    <section class="box-shadow-container">
      Have a comment or question on one of my posts? Start a discussion in my
      <a class="consistent-link" href="https://lists.sr.ht/~tristan957/public-inbox" target="_blank" rel="noreferrer noopener">
      public inbox</a>
      by sending an email to <a class="consistent-link" href="mailto:~tristan957/public-inbox@lists.sr.ht?Subject=Re: {{ .Title }}">
      ~tristan957/public-inbox@lists.sr.ht</a>. If you are unfamiliar with mailing lists, start with
      <a class="consistent-link" href="https://man.sr.ht/lists.sr.ht/etiquette.md" target="_blank" rel="noreferrer noopener">mailing list etiquette</a>.
      Otherwise just shoot me an email to my address which is linked in the sidebar. If you have a
      GitHub account and JavaScript enabled, then this site also has support for comments through
      <a class="consistent-link" href="https://utteranc.es" target="_blank" rel="noreferrer noopener">utteranc.es</a>.
      {{ with .Site.Params }}
        Have a comment or question on one of my posts?
        {{ with .mailingList }}
          Start a discussion in my
          <a class="consistent-link" href="{{ .archiveURL }}" target="_blank" rel="noreferrer noopener">
          public inbox</a>
          by sending an email to <a class="consistent-link" href="mailto:{{ .address }}?Subject=Re: {{ $.Title }}">
          {{ .address }}</a>. If you are unfamiliar with mailing lists, start with
          <a class="consistent-link" href="https://man.sr.ht/lists.sr.ht/etiquette.md" target="_blank" rel="noreferrer noopener">mailing list etiquette</a>.
          Otherwise just shoot me an email to my address which is linked in the sidebar.
        {{ end }}
        {{ if .utterances.enabled }}
          If you have a
          GitHub account and JavaScript enabled, then this site has support for comments through
          <a class="consistent-link" href="https://utteranc.es" target="_blank" rel="noreferrer noopener">utteranc.es</a>.
        {{ end }}
      {{ end }}
    </section>
    <!--Keep development quick and stop spamming GitHub API-->
    {{ if hugo.IsProduction }}
      <section id="comments-section" class="no-js box-shadow-container">
        <script type="text/javascript">
          let toggled = false;
          function toggleCommentsState(button) {
            toggled = !toggled;
            const utterancesFrame = document.getElementsByClassName("utterances-frame").item(0);
            const utterances = document.getElementsByClassName("utterances").item(0);
            if (toggled) {
              const height = utterancesFrame.clientHeight;
              utterancesFrame.classList.add("hidden");
              utterances.style.marginBottom = `-${height}px`;
              button.innerHTML = "Show Comments";
            } else {
              button.innerHTML = "Hide Comments";
              utterancesFrame.classList.remove("hidden");
              utterances.style.marginBottom = `0`;
    {{ with .Site.Params.utterances }}
      {{ if and hugo.IsProduction .enabled }}
        <section id="comments-section" class="no-js box-shadow-container">
          <script type="text/javascript">
            let toggled = false;
            function toggleCommentsState(button) {
              toggled = !toggled;
              const utterancesFrame = document.getElementsByClassName("utterances-frame").item(0);
              const utterances = document.getElementsByClassName("utterances").item(0);
              if (toggled) {
                const height = utterancesFrame.clientHeight;
                utterancesFrame.classList.add("hidden");
                utterances.style.marginBottom = `-${height}px`;
                button.innerHTML = "Show Comments";
              } else {
                button.innerHTML = "Hide Comments";
                utterancesFrame.classList.remove("hidden");
                utterances.style.marginBottom = `0`;
              }
            }
          }
        </script>
        <button class="btn" type="button" onclick="toggleCommentsState(this)">Hide Comments</button>
        <script type="text/javascript">
          function loadUtterances() {
            const utterancesScript = document.createElement("script");
            utterancesScript.setAttribute("id", "utterances-script");
            utterancesScript.setAttribute("src", "https://utteranc.es/client.js");
            utterancesScript.setAttribute("repo", "tristan957/tristan.partin.io");
            utterancesScript.setAttribute("issue-term", "pathname");
            utterancesScript.setAttribute("label", "comments");
            utterancesScript.setAttribute("theme", isDarkModeEnabled() ? "github-dark" : "github-light");
            utterancesScript.setAttribute("crossorigin", "anonymous");
            utterancesScript.setAttribute("async", "true");
          </script>
          <button class="btn" type="button" onclick="toggleCommentsState(this)">Hide Comments</button>
          <script type="text/javascript">
            function loadUtterances() {
              const utterancesScript = document.createElement("script");
              utterancesScript.setAttribute("id", "utterances-script");
              utterancesScript.setAttribute("src", "https://utteranc.es/client.js");
              utterancesScript.setAttribute("repo", "{{ .repo }}");
              utterancesScript.setAttribute("issue-term", "{{ .issueTerm }}");
              utterancesScript.setAttribute("label", "{{ .label }}");
              utterancesScript.setAttribute("theme", isDarkModeEnabled() ? "github-dark" : "github-light");
              utterancesScript.setAttribute("crossorigin", "anonymous");
              utterancesScript.setAttribute("async", "true");

            const commentsSection = document.getElementById("comments-section");
            commentsSection.appendChild(utterancesScript);
          }
              const commentsSection = document.getElementById("comments-section");
              commentsSection.appendChild(utterancesScript);
            }

          loadUtterances();
            loadUtterances();

          new MutationObserver(function(mutations) {
            const commentsSection = document.getElementById("comments-section");
            mutations.forEach(function(mutation) {
              if (mutation.type == "attributes") {
                const utterances = document.getElementsByClassName("utterances").item(0);
                if (utterances !== null) {
                  utterances.remove();
                  loadUtterances();
            new MutationObserver(function(mutations) {
              const commentsSection = document.getElementById("comments-section");
              mutations.forEach(function(mutation) {
                if (mutation.type == "attributes") {
                  const utterances = document.getElementsByClassName("utterances").item(0);
                  if (utterances !== null) {
                    utterances.remove();
                    loadUtterances();
                  }
                }
              }
            })
          }).observe(document.getElementsByTagName("html").item(0), { attributes: true });
        </script>
      </section>
              })
            }).observe(document.getElementsByTagName("html").item(0), { attributes: true });
          </script>
        </section>
      {{ end }}
    {{ end }}
  </section>
{{ end }}

M layouts/index.html => layouts/index.html +4 -2
@@ 17,9 17,11 @@
						{{ end }}
					</ul>
				</section>
				{{ partial "webring-out.html" }}
				{{ if .Site.Params.webring }}
					{{ partial "webring-out.html" }}
				{{ end }}
			</main>
			{{ partial "sidebar.html" }}
			{{ partial "sidebar.html" . }}
		</div>
	</div>
</body>

M layouts/partials/head.html => layouts/partials/head.html +17 -15
@@ 2,17 2,17 @@
	<meta http-equiv="content-type" content="text/html; charset=utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	{{ hugo.Generator }}
	<meta name="title" content="{{ .Title }} - Tristan Partin">
	<meta name="title" content="{{ .Title }} - {{ .Site.Author.name }}">
	<meta
		name="description"
		content="{{ if .Summary }}{{ .Summary }}{{ else if .Site.Params.Description }}{{ .Site.Params.Description }}{{ else }}Tristan Partin's personal website and blog.{{ end }}"
		content="{{ if .Summary }}{{ .Summary }}{{ else }}{{ .Site.Params.defaultDescription }}{{ end }}"
	>
	<meta name="author" content="Tristan Partin">
	<meta name="author" content="{{ .Site.Author.name }}">
	<meta name="rating" content="general">

	{{ if eq .Type "blog" }}
		<meta property="og:type" content="article">
		<meta property="og:article:author" content="Tristan Partin">
		<meta property="og:article:author" content="{{ .Site.Author.name }}">
		<meta property="og:article:published_time" content="{{ .Date }}">
		<meta property="og:article:modified_time" content="{{ .Lastmod }}">
		{{ range .Params.tags }}


@@ 21,20 21,22 @@
	{{ else }}
		<meta property="og:type" content="website">
	{{ end }}
	<meta property="og:title" content="{{ .Title }} - Tristan Partin">
	<meta property="og:title" content="{{ .Title }} - {{ .Site.Author.name }}">
	<meta property="og:url" content="{{ .Permalink }}">
	{{ $siteImage := resources.Get "images/astronaut-on-the-moon-with-a-beer-looking-at-earth.jpg" }}
	<meta property="og:image" content="{{ $siteImage.Permalink }}">
	<meta property="og:image:secure_url" content="{{ $siteImage.Permalink }}">
	<meta property="og:image:type" content="image/jpeg">
	<meta property="og:image:width" content="{{ $siteImage.Width }}">
	<meta property="og:image:height" content="{{ $siteImage.Height }}">
	<meta property="og:image:alt" content="Astronaut with a beer sitting in a lawn chair looking at the Earth from the Moon">
	<meta
		property="og:description"
		content="{{ if .Summary }}{{ .Summary }}{{ else if .Site.Params.Description }}{{ .Site.Params.Description }}{{ else }}Tristan Partin's personal website and blog.{{ end }}"
		content="{{ if .Summary }}{{ .Summary }}{{ else }}{{ .Site.Params.defaultDescription }}{{ end }}"
	>
	<meta property="og:locale" content="en_US">
	<meta property="og:locale" content="{{ replace .Site.LanguageCode "-" "_" }}">
	{{ with .Site.Params.siteImage }}
		{{ $siteImage := resources.Get .resourcePath }}
		<meta property="og:image" content="{{ $siteImage.Permalink }}">
		<meta property="og:image:secure_url" content="{{ $siteImage.Permalink }}">
		<meta property="og:image:alt" content="{{ .alt }}">
		<meta property="og:image:type" content="{{ $siteImage.MediaType }}">
		<meta property="og:image:width" content="{{ $siteImage.Width }}">
		<meta property="og:image:height" content="{{ $siteImage.Height }}">
	{{ end }}

	{{ $styleCss := resources.Get "css/style.css" | minify | fingerprint }}
	{{ $fontello := resources.Get "fonts/fontello/css/fontello.css" | minify | fingerprint }}


@@ 108,7 110,7 @@
		}
	</style>

	<title>{{ .Title }} - Tristan Partin</title>
	<title>{{ .Title }} - {{ .Site.Author.name }}</title>
	<link rel="canonical" href="{{ .Permalink }}" />
	<link rel="icon" type="image/x-icon" href="/favicon.ico" />
</head>

M layouts/partials/sidebar.html => layouts/partials/sidebar.html +51 -42
@@ 1,34 1,46 @@
<section id="sidebar" class="box-shadow-container">
	{{ $profile := resources.Get "images/profile.webp" | fingerprint }}
	<img id="profile-picture" src="{{ $profile.RelPermalink }}" loading="lazy" alt="Profile Picture" title="Profile Picture" width="200px" height="200px" />
	<div id="resume" class="centered">
		<a class="consistent-link" href="/documents/My_Resume.pdf" target="_blank" rel="noopener noreferrer"><i class="icon icon-file-pdf"></i>Resume</a>
	</div>
	{{ with .Site.Params.resume }}
		<div id="resume" class="centered">
			<a class="consistent-link" href="{{ .url }}" target="_blank" rel="noopener noreferrer"><i class="icon icon-file-pdf"></i>Resume</a>
		</div>
	{{ end }}
	<p>
		I am a human. I do human things.
	</p>
	<address>
		<ul class="undecorated-list contact-list">
			<li>
				<div>sourcehut</div>
				<a class="consistent-link" href="https://git.sr.ht/~tristan957" target="_blank" rel="noopener noreferrer">~tristan957</a>
			</li>
			<li>
				<div>github</div>
				<a class="consistent-link" href="https://github.com/tristan957" target="_blank" rel="noopener noreferrer">tristan957</a>
			</li>
			<li>
				<div>mastodon</div>
				<a class="consistent-link" href="https://mastodon.social/@tristan957" target="_blank" rel="me noopener noreferrer">@tristan957@mastodon.social</a>
			</li>
			<li>
				<div>linkedin</div>
				<a class="consistent-link" href="https://linkedin.com/in/tristan-partin" target="_blank" rel="noopener noreferrer">tristan-partin</a>
			</li>
			<li>
				<div>email</div>
				<a class="consistent-link" href="mailto:tristan@partin.io"><span class="email-component">tristan</span><span class="email-component">@</span><span class="email-component">partin</span><span class="email-component">.</span><span class="email-component">io</span></a>
			</li>
			{{ with .Site.Params.socials.sourceHut }}
				<li>
					<div>sourcehut</div>
					<a class="consistent-link" href="{{ .url }}" target="_blank" rel="noopener noreferrer">{{ .username }}</a>
				</li>
			{{ end }}
			{{ with .Site.Params.socials.gitHub }}
				<li>
					<div>github</div>
					<a class="consistent-link" href="{{ .url }}" target="_blank" rel="noopener noreferrer">{{ .username }}</a>
				</li>
			{{ end }}
			{{ with .Site.Params.socials.mastodon }}
				<li>
					<div>mastodon</div>
					<a class="consistent-link" href="{{ .url }}" target="_blank" rel="me noopener noreferrer">{{ .username }}</a>
				</li>
			{{ end }}
			{{ with .Site.Params.socials.linkedIn }}
				<li>
					<div>linkedin</div>
					<a class="consistent-link" href="{{ .url }}" target="_blank" rel="noopener noreferrer">{{ .username }}</a>
				</li>
			{{ end }}
			{{ with .Site.Params.email }}
				<li>
					<div>email</div>
					<a class="consistent-link" href="mailto:{{ .beforeAt }}@{{ .afterAtBeforeDot }}.{{ .tld }}"><span class="email-component">{{ .beforeAt }}</span><span class="email-component">@</span><span class="email-component">{{ .afterAtBeforeDot }}</span><span class="email-component">.</span><span class="email-component">{{ .tld }}</span></a>
				</li>
			{{ end }}
		</ul>
	</address>
	<button id="theme-btn" type="button" class="btn no-js" aria-label="Toggle Site Theme" onclick="overrideTheme(this)"></button>


@@ 41,33 53,30 @@
		themeButton.innerHTML = isDarkModePreferred ? "Light Theme" : "Dark Theme";
	</script>
	<div class="sidebar-section">
		<div class="sidebar-section-header">License</div>
		<p class="sidebar-paragraph">
			The content on this site is
			<a class="consistent-link" href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank" rel="noopener noreferrer">CC-BY-SA-4.0</a>.
			The code for this site is
			<a class="consistent-link" href="https://opensource.org/licenses/AGPL-3.0" target="_blank" rel="noopener noreferrer">AGPL-3.0</a>.
		</p>
		{{ with .Site.Params.licenses }}
			<div class="sidebar-section-header">License</div>
			<p class="sidebar-paragraph">
				The content on this site is
				<a class="consistent-link" href="{{ .content.url }}" target="_blank" rel="noopener noreferrer">{{ .content.license }}</a>.
				The code for this site is
				<a class="consistent-link" href="{{ .code.url }}" target="_blank" rel="noopener noreferrer">{{ .code.license }}</a>.
			</p>
		{{ end }}
	</div>
	<hr />
	<p class="smaller-text">
		This code and content for this site can be found on
		<a class="consistent-link" href="https://git.sr.ht/~tristan957/tristan.partin.io" target="_blank" rel="noopener noreferrer">SourceHut</a>.
	</p>
	<p class="smaller-text">
		Please file issues/bugs on the SourceHut
		<a class="consistent-link" href="https://todo.sr.ht/~tristan957/tristan.partin.io" target="_blank" rel="noopener noreferrer">todo tracker</a>,
		the GitHub <a class="consistent-link" href="https://github.com/tristan957/tristan.partin.io/issues" target="_blank", rel="noopener noreferrer">
		issue tracker</a>, or send an email to my <a class="consistent-link" href="mailto:~tristan957/public-inbox@lists.sr.ht?Subject=Re: {{ .Title }}">
    public inbox</a>.
	</p>
	{{ with .Site.Params.repository }}
		<p class="smaller-text">
			This code and content for this site can be found on
			<a class="consistent-link" href="{{ .url }}" target="_blank" rel="noopener noreferrer">{{ .forge }}</a>.
		</p>
	{{ end }}
	<p class="smaller-text">
		This site uses absolutely no analytics or tracking mechanisms.
	</p>
	{{ with .GitInfo }}
		<hr />
<pre class="monospace smaller-text" aria-label="Git Info">
Commit:	<a class="consistent-link" href="https://git.sr.ht/~tristan957/tristan.partin.io/commit/{{ .Hash }}" target="_blank" rel="noopener noreferrer">{{ .AbbreviatedHash }}</a>
Commit:	<a class="consistent-link" href="{{ printf $.Site.Params.repository.commitURLPattern .Hash }}" target="_blank" rel="noopener noreferrer">{{ .AbbreviatedHash }}</a>
</pre>
	{{ end }}
</section>