summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/posts/abstractions/post.rs1
-rw-r--r--src/posts/fs_post.rs15
-rw-r--r--templates/base.html14
-rw-r--r--templates/post.html11
4 files changed, 36 insertions, 5 deletions
diff --git a/src/posts/abstractions/post.rs b/src/posts/abstractions/post.rs
index a941281..9667828 100644
--- a/src/posts/abstractions/post.rs
+++ b/src/posts/abstractions/post.rs
@@ -3,4 +3,5 @@ use std::{borrow::Cow, fmt};
pub trait Post: fmt::Debug + Ord {
fn get_title(&self) -> &str;
fn get_article(&self) -> Cow<str>;
+ fn get_description(&self) -> Cow<str>;
}
diff --git a/src/posts/fs_post.rs b/src/posts/fs_post.rs
index 8b8e725..a1de678 100644
--- a/src/posts/fs_post.rs
+++ b/src/posts/fs_post.rs
@@ -21,6 +21,21 @@ impl Post for FsPost {
let article = fs::read_to_string(&self.file).unwrap();
Cow::Owned(article)
}
+
+ fn get_description(&self) -> Cow<str> {
+ let article = self.get_article();
+ Cow::Owned(
+ article
+ .split_once("\n")
+ .map(|(first, _)| first)
+ .unwrap_or_default()
+ .trim_start_matches('_')
+ .trim_start_matches('*')
+ .trim_end_matches('_')
+ .trim_end_matches('*')
+ .to_owned(),
+ )
+ }
}
impl Ord for FsPost {
diff --git a/templates/base.html b/templates/base.html
index 74999df..b051c0f 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -3,7 +3,9 @@
<head>
<title>
+ {% block title %}
Tutoring Excellence Online and in Suffolk, VA - Carpenter Tutoring, LLC
+ {% endblock %}
</title>
<style>
{% block style %}
@@ -15,14 +17,16 @@
<link rel="stylesheet" href="/widescreen.css" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
- <meta name="description" content="Tutoring Excellence Online and in Suffolk, VA" />
- <meta property="og:description" content="Tutoring excellence online and in-person" />
<meta property="og:image" content="https://carpentertutoring.com/assets/logo.webp" />
<meta property="og:image:secure_url" content="https://carpentertutoring.com/assets/logo.webp" />
- <meta property="og:site_name" content="Carpenter Tutoring" />
- <meta property="og:title" content="Tutoring Excellence Online and in Suffolk, VA - Carpenter Tutoring, LLC" />
+ <meta property="og:site_name" content="Carpenter Tutoring, LLC" />
<meta property="og:type" content="website" />
+ {% block og %}
+ <meta name="description" content="Tutoring Excellence Online and in Suffolk, VA" />
+ <meta property="og:description" content="Tutoring excellence online and in-person" />
+ <meta property="og:title" content="Tutoring Excellence Online and in Suffolk, VA - Carpenter Tutoring, LLC" />
<meta property="og:url" content="https://carpentertutoring.com" />
+ {% endblock %}
</head>
@@ -41,9 +45,9 @@
<nav>
<a href="/#"><img alt="logo" src="/assets/logo-simple.png" /></a>
<a href="/#offerings">Services</a>
+ <a href="/posts">Posts</a>
<a href="/brochure">Brochure</a>
<a href="/#help">Helpful Links</a>
- <a href="/posts">Posts</a>
<a href="/policies">Policies</a>
<a href="/about">Team</a>
<a href="/#reviews">Reviews</a>
diff --git a/templates/post.html b/templates/post.html
index 3155c7a..fb8d28b 100644
--- a/templates/post.html
+++ b/templates/post.html
@@ -1,5 +1,16 @@
{% extends "base.html" %}
+{% block title %}
+{{ post.get_title() }} - Carpenter Tutoring, LLC
+{% endblock %}
+
+{% block og %}
+<meta name="description" content="{{ post.get_description() }}" />
+<meta property="og:description" content="{{ post.get_description() }}" />
+<meta property="og:title" content="{{ post.get_title() }}" />
+<meta property="og:url" content="https://carpentertutoring.com/posts/{{ post.get_title()|e }}" />
+{% endblock %}
+
{% block main %}
<section class="banner">
<h1>{{ post.get_title() }}</h1>