Skip to content

Commit

Permalink
add mastodon support (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
prabirshrestha authored Aug 11, 2023
1 parent d70fa46 commit 8b05dda
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions blog.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ enable_drafts: false
posts_dir: ./posts
github: prabirshrestha
twitter: prabirshrestha
mastodon: https://mastodon.social/@prabirshrestha
syntax_highlight: true
# google_analytics:
# ga_measurement_id: changeme
Expand Down
5 changes: 5 additions & 0 deletions src/blog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub struct BlogConf {
enable_drafts: Option<bool>,
posts_dir: Option<String>,
github: Option<String>,
mastodon: Option<String>,
twitter: Option<String>,
disqus: Option<String>,
giscus: Option<Giscus>,
Expand Down Expand Up @@ -177,6 +178,10 @@ impl BlogConf {
self.github.as_deref()
}

pub fn get_mastodon(&self) -> Option<&str> {
self.mastodon.as_deref()
}

pub fn get_twitter(&self) -> Option<&str> {
self.twitter.as_deref()
}
Expand Down
6 changes: 6 additions & 0 deletions templates/base.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
@if let Some(github) = blog.get_blog_conf().get_github() {
<a href="https://github.com/@github">Github</a>
}
@if let Some(mastodon) = blog.get_blog_conf().get_mastodon() {
<a href="@mastodon">Mastodon</a>
}
@if let Some(twitter) = blog.get_blog_conf().get_twitter() {
<a href="https://twitter.com/@twitter">Twitter</a>
}
Expand All @@ -35,6 +38,9 @@
@if let Some(github) = blog.get_blog_conf().get_github() {
<a href="https://github.com/@github">Github</a>
}
@if let Some(mastodon) = blog.get_blog_conf().get_mastodon() {
<a href="@mastodon">Mastodon</a>
}
@if let Some(twitter) = blog.get_blog_conf().get_twitter() {
<a href="https://twitter.com/@twitter">Twitter</a>
}
Expand Down

0 comments on commit 8b05dda

Please sign in to comment.