~ben/web

ea4475097fb9b7b0bc1e731a38f26777f2c10a09 — Ben Sima 1 year, 3 months ago aae09fb
Add projects, clogposts, and reading
3 files changed, 110 insertions(+), 6 deletions(-)

M Main.hs
M assets/css/main.css
M templates/index.html
M Main.hs => Main.hs +11 -4
@@ 71,11 71,18 @@ sass =
indexRules :: Rules ()
indexRules = do
    route $ setExtension ".html"
    compile $
    compile $ do
        projects <- loadAll "projects/*"
        clogPosts <- recentFirst =<< loadAll "clog/*"
        reading <- recentFirst =<< loadAll "reading/*"
        let ctx = listField "clogPosts" (postCtx) (return clogPosts)
                  <> listField "projects" defaultContext (return projects)
                  <> listField "reading" defaultContext (return reading)
                  <> defaultContext
        pandocCompiler >>=
        loadAndApplyTemplate "templates/index.html" defaultContext >>=
        loadAndApplyTemplate "templates/default.html" defaultContext >>=
        relativizeUrls
            loadAndApplyTemplate "templates/index.html" ctx >>=
            loadAndApplyTemplate "templates/default.html" ctx >>=
            relativizeUrls

liveRules :: Rules ()
liveRules = do

M assets/css/main.css => assets/css/main.css +6 -1
@@ 70,7 70,6 @@
; font-style: normal
}


html, body
{ margin: 0
; padding: 0


@@ 200,6 199,12 @@ img.badge
{ width: initial
}

article#index
{ display: flex
; align-items: center
; min-height: 100vh
}

#projects h3, #clog-index h3
{ margin-bottom: 1rem
}

M templates/index.html => templates/index.html +93 -1
@@ 1,3 1,95 @@
<article>
<article id="index">
  $body$
</article>

<section id="clog-index">
  <h2>Code Log</h2>
  <h3>Projects</h3>
  <p>Some of the software I have written or contributed to.
    See also
    <a href="https://github.com/bsima" target="_blank">github.com/bsima</a>
    and
    <a href="https://git.sr.ht/~ben" target="_blank">git.sr.ht/~ben</a>
  </p>
  <h4>Active</h4>
  <ul>
    $for(projects)$
    $if(active)$
    <li class="a-project">
      <a href="$url$">$title$</a>
      <ul class="sans-serif project-submenu">
        $if(travis)$
        <li>
          <a class="naked" href="https://travis-ci.org/$travis$">
            <img class="badge" src="https://travis-ci.org/$travis$.svg?branch=master"/>
          </a>
        </li>
        $endif$

        $if(link)$
        <li><a class="naked" target="_blank" href="$link$">Link</a></li>
        $endif$

        $if(source)$
        <li><a class="naked" target="_blank" href="$source$">Source</a></li>
        $endif$
      </ul>

      <p class="tldr">$description$</p>
    </li>
    $else$
    $endif$
    $endfor$
  </ul>

  <h4>Past</h4>
  <ul>
    $for(projects)$
    $if(active)$
    $else$
    <li class="a-project">
          <a href="$url$">$title$</a>
          <ul class="sans-serif project-submenu">
            $if(travis)$
            <li>
              <a class="naked" href="https://travis-ci.org/$travis$">
                <img class="badge" src="https://travis-ci.org/$travis$.svg?branch=master"/>
              </a>
            </li>
            $endif$

            $if(link)$
            <li><a class="naked" target="_blank" href="$link$">Link</a></li>
            $endif$

            $if(source)$
            <li><a class="naked" target="_blank" href="$source$">Source</a></li>
            $endif$
          </ul>
          <p class="tldr">$description$</p>
    </li>
    $endif$
    $endfor$
  </ul>

  <h3>Articles</h3>
  <ul>
  $for(clogPosts)$
  <li>
    <a href="$url$">$title$</a>
    $if(tldr)$ <p class="tldr">$tldr$</p> $endif$
  </li>
  $endfor$
  </ul>
</section>

<section>
  <h2>Reading Notes</h2>
  <ul>
  $for(reading)$
  <li>
    <a href="$url$">$title$</a>
  </li>
  $endfor$
  </ul>
</section>