Skip to content

Commit 105f33e

Browse files
committed
feat: add comments
with giscus
1 parent 6fb5a37 commit 105f33e

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed

src/pages/blog.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub fn Blog() -> impl IntoView {
2828
}
2929
}
3030

31+
#[allow(dead_code)]
3132
fn retrieve_blog_posts_files() -> Vec<PathBuf> {
3233
let paths = fs::read_dir("./assets/posts/").unwrap();
3334
paths

src/pages/comments.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
use leptos::prelude::*;
2+
3+
#[component]
4+
pub fn GiscusComments() -> impl IntoView {
5+
view! {
6+
<div class="giscus"></div>
7+
8+
<script
9+
src="https://giscus.app/client.js"
10+
data-repo="edpyt/blog"
11+
data-repo-id="R_kgDOPA8L5Q"
12+
data-category="General"
13+
data-category-id="DIC_kwDOPA8L5c4Cr9M0"
14+
data-mapping="url"
15+
data-strict="0"
16+
data-reactions-enabled="1"
17+
data-emit-metadata="0"
18+
data-input-position="bottom"
19+
data-theme="preferred_color_scheme"
20+
data-lang="en"
21+
crossorigin="anonymous"
22+
async
23+
></script>
24+
}
25+
}

src/pages/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
pub mod about;
22
pub mod blog;
3+
pub mod comments;
34
pub mod post;

src/pages/post.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ use leptos_router::hooks::use_params;
44
use leptos_router::params::Params;
55
use uuid::Uuid;
66

7+
use crate::pages::comments::GiscusComments;
8+
79
#[derive(Params, PartialEq, Clone, Debug)]
810
struct PostParams {
911
post_uuid: Option<Uuid>,
@@ -21,5 +23,7 @@ pub fn Post() -> impl IntoView {
2123
None => Either::Left(view! { <p>"No post with this UUID was found."</p> }),
2224
Some(post_uuid) => Either::Right(view! { <p>"Found!"{post_uuid.to_string()}</p> }),
2325
}}
26+
27+
<GiscusComments />
2428
}
2529
}

0 commit comments

Comments
 (0)