{{ define "partials/list-limited.html" }}

{{/* This is not pretty but I'm not good at templates */}}
{{ $params := . | transform.Unmarshal (dict "delimiter" ";") }}
{{ $fields := index $params 0 }}
{{ $pageurl := index $fields 0 }}
{{ $pagename := index $fields 1 }}
{{ $limit := 5 }}
{{ $pages := where site.RegularPages "Section" $pageurl }}
{{- with $pages }}
<section class="post-list">
	<h2>Latest {{$pagename}}</h2>
  {{- range ( $pages | first $limit ) }}
    <article><time datetime="{{ .Date | time.Format "2006-01-02"}}">{{ .Date | time.Format "2006-01-02"}}</time> <a class="title" href="{{ .RelPermalink }}">{{ .Title }}</a></article>
  {{ end }}
  {{ if (gt ($pages | len) $limit )}}
<a href="/{{ $pageurl }}">See more…</a>
  {{ end }}
</section>
{{ end }}

{{ end }}

{{ define "main" }}
<header class="site-header">
  <h1 class="title">Hello, this is a webpage</h1>
</header>
<section class="intro">
  <p>
    I'm your random internet dude and I figured that if I wrote something
    on the Internet then someone might read it, also I needed a
    website cause everyone got one of those!
  </p>
  <h2>What did you do?!</h2>
  <p>
    Here are some of my more known projects, or rather, projects I'd prefer to
    be known for:
  </p>
  <ul class="project-list">
    <li>
      <a href="https://github.com/Hamcha/tghandbook">/tg/station Handbook</a>, a
      userscript that grew way out of scope
    </li>
    <li>
      <a href="https://git.fromouter.space/crunchy-rocks/clessy-ng">Clessy</a>,
      the <i>I-wish-it-wasnt-popular</i> multifunction Telegram bot
    </li>
    <li>
      <a href="https://github.com/Hamcha/lumaupdate">Luma Updater</a>, my (now
      very outdated) 3DS homebrew for updating Luma3DS
    </li>
    <li>
      The <a href="https://github.com/hoverguys/hovercraft-old">two</a>
      <a href="https://github.com/hoverguys/rehover">times</a> I tried to make a
      Gamecube homebrew racing game.
    </li>
    <li>
      <a
        href="https://forum.unity.com/threads/how-would-i-find-a-specific-gameobject-for-the-camera-to-follow.490515/#post-3197196"
        >Apparently</a
      >, porting
      <a href="https://gist.github.com/Hamcha/6096905"
        >a stock Unity 3.x script to C#</a
      >. I am still very confused about this by the way. I even
      <a href="https://hiewb.itch.io/black-friday-mania">got credited</a> for
      this!
    </li>
  </ul>
  <h2>What's in this desperate corner of the net?</h2>
  <p>
    In here you will find my blog where I discuss things that I give enough
    thought to actually write long form posts about rather than just rant on DMs
    and other resources that I've been publishing all over the place and in dire
    need of a more permanent home. Check the links at the top or look below for
    the latest posts!
  </p>
  <h3>Miscellaneous link collection of ultimate destiny

  </h3>
  <p>Find me at any of these places: 
    {{ range $name, $link := $.Site.Data.home.links }}
      <span class="home-link"><a href="{{ $link }}">{{ $name }}</a></span>
    {{ end }}</p>
</section>
  {{ partial "list-limited.html" "posts;posts" }}
  {{ partial "list-limited.html" "pages;pages" }}
{{ end }}
