Module: Railspress::ApplicationHelper
- Defined in:
- app/helpers/railspress/application_helper.rb
Instance Method Summary collapse
-
#rp_featured_image_url(post, variant: { resize_to_limit: [ 1200, 630 ] }) ⇒ String?
Returns the featured image URL for a post, useful for og:image meta tags.
-
#rp_reading_time(post, format: :short) ⇒ String
Formats reading time for display.
Instance Method Details
#rp_featured_image_url(post, variant: { resize_to_limit: [ 1200, 630 ] }) ⇒ String?
Returns the featured image URL for a post, useful for og:image meta tags
21 22 23 24 25 |
# File 'app/helpers/railspress/application_helper.rb', line 21 def rp_featured_image_url(post, variant: { resize_to_limit: [ 1200, 630 ] }) return nil unless post.header_image.attached? main_app.url_for(post.header_image.variant(variant)) end |
#rp_reading_time(post, format: :short) ⇒ String
Formats reading time for display
7 8 9 10 11 12 13 14 15 |
# File 'app/helpers/railspress/application_helper.rb', line 7 def rp_reading_time(post, format: :short) minutes = post.reading_time_display case format when :long "#{minutes} minute read" else "#{minutes} min" end end |