Skip to content

Commit

Permalink
feat: added footer and "about this site" section
Browse files Browse the repository at this point in the history
Signed-off-by: Luke Carr <[email protected]>
  • Loading branch information
lukecarr committed Aug 5, 2022
1 parent 06258d9 commit d4d21b5
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 15 deletions.
13 changes: 9 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@ use sailfish::TemplateOnce;

fn main() {
let now = Instant::now();
let build_time = Utc::now();

fs::create_dir_all("out").expect("Failed to create ouput directory");

let index = IndexPage {
age: get_age(),
title: "Luke Carr".to_owned()
title: "Luke Carr".to_owned(),
build_time: build_time.to_rfc3339(),
};
build_index(index).expect("Failed to build index page");

let links = LinksPage {
title: "Links :: Luke Carr".to_owned()
title: "Links :: Luke Carr".to_owned(),
build_time: build_time.to_rfc3339(),
};
build_links(links).expect("Failed to build links page");

Expand All @@ -36,7 +39,8 @@ fn get_age() -> u8 {
#[template(path = "index.stpl")]
struct IndexPage {
age: u8,
title: String
title: String,
build_time: String,
}

fn build_index(ctx: IndexPage) -> std::io::Result<()> {
Expand All @@ -46,7 +50,8 @@ fn build_index(ctx: IndexPage) -> std::io::Result<()> {
#[derive(TemplateOnce)]
#[template(path = "links.stpl")]
struct LinksPage {
title: String
title: String,
build_time: String,
}

fn build_links(ctx: LinksPage) -> std::io::Result<()> {
Expand Down
4 changes: 4 additions & 0 deletions templates/footer.stpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<footer>
<hr>
<p><small>Site built at <code><%= build_time %></code>.</small></p>
</footer>
5 changes: 1 addition & 4 deletions templates/header.stpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<header id="header">
<h1>Luke Carr</h1>
<nav id="nav">
<a href="/">about me</a>
<a href="/links">links</a>
</nav>
<% include!("./nav.stpl"); %>
</header>
29 changes: 22 additions & 7 deletions templates/index.stpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,27 @@
<% include!("./head.stpl"); %>
<body>
<% include!("./header.stpl"); %>
<h2>about me</h2>
<blockquote>
<p><strong>Hi there! &#128075;</strong></p>
<p>I&apos;m a <%= age %> y/o from the UK, currently working as a <strong>Software Developer</strong> at <strong>Sitel Group</strong>.</p>
<p>As far as open source projects go, I enjoy working on anything and everything related to <strong>education &#127979;</strong>, <strong>privacy &#128064;</strong>, and <strong>data analysis/engineering &#128451;</strong>.</p>
<p>I currently spend most of time in <strong>Rust</strong> and <strong>Python</strong>, and I take pride in writing code that&apos;s <strong>lightweight &#127811;</strong> and <strong>performant &#128170;</strong>!</p>
</blockquote>
<section id="about-me">
<h2>about me</h2>
<blockquote>
<p><strong>Hi there! &#128075;</strong></p>
<p>I&apos;m a <%= age %> y/o from the UK, currently working as a <strong>Software Developer</strong> at <strong>Sitel Group</strong>.</p>
<p>As far as open source projects go, I enjoy working on anything and everything related to <strong>education &#127979;</strong>, <strong>privacy &#128064;</strong>, and <strong>data analysis/engineering &#128451;</strong>.</p>
<p>I currently spend most of time in <strong>Rust</strong> and <strong>Python</strong>, and I take pride in writing code that&apos;s <strong>lightweight &#127811;</strong> and <strong>performant &#128170;</strong>!</p>
</blockquote>
</section>
<section id="about-the-site">
<h2>about this site</h2>
<blockquote>
<p>This site is built using a <strong>custom static site generator</strong> made with <strong>Rust</strong><a href="#site-ref-1"><sup>[1]</sup></a>.</p>
<p>It has <strong>no CSS or JavaScript</strong> and each page weighs in at a <strong>few kilobytes</strong>.</p>
<p>The site is hosted on a single VPS with 1 GiB RAM<a href="#site-ref-2"><sup>[2]</sup></a>, running a sole web server process to serve static files and handle TLS<a href="#site-ref-3"><sup>[3]</sup></a>.</p>
<hr>
<p id="site-ref-1"><sup>[1]</sup> <a href="https://github.com/rust-sailfish/sailfish" target="_blank" rel="noopener">Sailfish</a> is used for templating. The entire generator codebase comes in at &lt;100 LOC.</p>
<p id="site-ref-2"><sup>[2]</sup> Hosted at <a href="https://1984.hosting" target="_blank" rel="noopener">1984 Hosting</a>: <strong>not affiliated</strong>, but a very happy customer!</p>
<p id="site-ref-3"><sup>[3]</sup> Web server currently used is <a href="https://caddyserver.com/v2" target="_blank" rel="noopener">Caddy 2</a>.</p>
</blockquote>
</section>
<% include!("./footer.stpl"); %>
</body>
</html>
1 change: 1 addition & 0 deletions templates/links.stpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
<ul>
<li><a href="https://sr.ht/~carr" target="_blank" rel="noopener">Sourcehut (~carr)</a></li>
</ul>
<% include!("./footer.stpl"); %>
</body>
</html>
4 changes: 4 additions & 0 deletions templates/nav.stpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<nav id="nav">
<a href="/">home</a>
<a href="/links">links</a>
</nav>

0 comments on commit d4d21b5

Please sign in to comment.