Link to edit articles on github

This commit is contained in:
Pantonshire committed 2022-07-08 20:45:51 +01:00
1 parent 3086bf170f
commit 4f9bbab97b
4 files changed
+19 -2

No files matched your search

+10
View File
@@ -302,6 +302,16 @@ ul.articles_list {
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
} }
.article_edit {
font-size: 1rem;
margin-top: 0.5rem;
margin-bottom: 0.5rem;
}
.article_edit a {
color: #898989;
}
.codeblock { .codeblock {
margin-top: 1.5rem; margin-top: 1.5rem;
margin-bottom: 2rem; margin-bottom: 2rem;
+1 -1
View File
@@ -15,7 +15,7 @@ posts_dir = "./articles/src/"
post_media_dir = "./articles/media/" post_media_dir = "./articles/media/"
[github] [github]
source_url = "https://github.com/pantonshire/blog_content/blob/main/src" edit_url = "https://github.com/pantonshire/blog_content/edit/main/src"
[rss] [rss]
num_posts = 20 num_posts = 20
+1 -1
View File
@@ -35,7 +35,7 @@ pub(crate) struct ContentConfig {
#[derive(Deserialize, Clone, Debug)] #[derive(Deserialize, Clone, Debug)]
pub(crate) struct GithubConfig { pub(crate) struct GithubConfig {
pub source_url: Option<String>, pub edit_url: Option<String>,
} }
#[derive(Deserialize, Clone, Debug)] #[derive(Deserialize, Clone, Debug)]
+7
View File
@@ -32,6 +32,13 @@ pub(super) async fn handle(
p .article_subtitle { (subtitle) } p .article_subtitle { (subtitle) }
} }
p .article_published_date { "Published " (post.published().format("%Y/%m/%d")) } p .article_published_date { "Published " (post.published().format("%Y/%m/%d")) }
@if let Some(source_url) = context.config().github.edit_url.as_deref() {
p .article_edit {
a href={(source_url) "/" (post.id()) ".toml.md"} {
"Propose a change on GitHub"
}
}
}
} }
article .article_content { article .article_content {
(post.html()) (post.html())