diff --git a/content/static/styles/main.css b/content/static/styles/main.css index c8f19e4..9ec9d56 100644 --- a/content/static/styles/main.css +++ b/content/static/styles/main.css @@ -302,6 +302,16 @@ ul.articles_list { margin-bottom: 0.5rem; } +.article_edit { + font-size: 1rem; + margin-top: 0.5rem; + margin-bottom: 0.5rem; +} + +.article_edit a { + color: #898989; +} + .codeblock { margin-top: 1.5rem; margin-bottom: 2rem; diff --git a/example_config.toml b/example_config.toml index a7635b4..4987a87 100644 --- a/example_config.toml +++ b/example_config.toml @@ -15,7 +15,7 @@ posts_dir = "./articles/src/" post_media_dir = "./articles/media/" [github] -source_url = "https://github.com/pantonshire/blog_content/blob/main/src" +edit_url = "https://github.com/pantonshire/blog_content/edit/main/src" [rss] num_posts = 20 diff --git a/src/bin/blog_server/config.rs b/src/bin/blog_server/config.rs index 07745c0..dee025d 100644 --- a/src/bin/blog_server/config.rs +++ b/src/bin/blog_server/config.rs @@ -35,7 +35,7 @@ pub(crate) struct ContentConfig { #[derive(Deserialize, Clone, Debug)] pub(crate) struct GithubConfig { - pub source_url: Option, + pub edit_url: Option, } #[derive(Deserialize, Clone, Debug)] diff --git a/src/bin/blog_server/service/post.rs b/src/bin/blog_server/service/post.rs index 3e90c25..bf8197c 100644 --- a/src/bin/blog_server/service/post.rs +++ b/src/bin/blog_server/service/post.rs @@ -32,6 +32,13 @@ pub(super) async fn handle( p .article_subtitle { (subtitle) } } 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 { (post.html())