about summary refs log tree commit diff stats
path: root/app/controllers/streams_controller.rb
blob: ec4cee81ab854d87cf67829afd16178b730e4a23 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class StreamsController < ApplicationController
  include ApplicationHelper

  def index
    @streams = Stream.order(latest_post_at: :desc).paginate(page: params[:page], per_page: 10)
  end

  def show
    @stream = Stream.find_by_slug(params[:slug])
    @updates = @stream.updates.paginate(page: params[:page], per_page: 10)

    body = stripped_markdown(@stream.body)

    set_meta_tags(og: {
      title: @stream.title,
      type: "article",
      description: body[0, 299],
      url: stream_url(@stream, host: "www.fourisland.com"),
      article: {
        published_time: @stream.created_at.iso8601,
        modified_time: @stream.latest_post_at.iso8601
      }
    })
  end

end