From 85de7c04ab66e8029d69b350fbfecd22a8673fc2 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 11 Oct 2023 12:26:55 -0400 Subject: Blog title links --- app/assets/stylesheets/main/entries.scss | 15 ++++++++++++++- app/models/blog.rb | 4 ++++ app/views/blogs/_blog.html.haml | 6 +++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/main/entries.scss b/app/assets/stylesheets/main/entries.scss index 1b2d1c6..b511333 100644 --- a/app/assets/stylesheets/main/entries.scss +++ b/app/assets/stylesheets/main/entries.scss @@ -5,7 +5,7 @@ #blog-post { font-size: 16px; line-height: 24px; - margin: 0 1em; + margin: 0 1em 1em; .blog-title { h2 { @@ -16,6 +16,19 @@ color: #59770e; border-bottom: 1px dotted #CCCCCC; padding-bottom: 3px; + + a { + text-decoration: none; + color: #59770e; + + &:visited { + color: #59770e; + } + + &:hover { + text-decoration: underline; + } + } } } diff --git a/app/models/blog.rb b/app/models/blog.rb index c12d0dc..415167c 100644 --- a/app/models/blog.rb +++ b/app/models/blog.rb @@ -26,6 +26,10 @@ class Blog < ApplicationRecord body[0..(body.index("")-1)] end + def to_param + slug + end + private def set_draft_title if self.title.blank? and not self.published diff --git a/app/views/blogs/_blog.html.haml b/app/views/blogs/_blog.html.haml index 389f961..26657e7 100644 --- a/app/views/blogs/_blog.html.haml +++ b/app/views/blogs/_blog.html.haml @@ -4,7 +4,7 @@ %span.post-month= blog.published_at.strftime("%^b") %span.post-day= blog.published_at.day .blog-title - %h2= blog.title + %h2= link_to_unless_current blog.title, blog .post-author Hatkirby %blockquote#blog-content.entry-content.bubble.rounded.bottom - if short and blog.has_read_more @@ -12,3 +12,7 @@ = link_to "Read more...", blog - else = markdown(blog.body) + %cite.bubble + %strong Hatkirby + on + = blog.published_at.strftime("%m-%d-%Y") -- cgit 1.4.1