Sha256: e8a985ce9878b2c65f8b7616e2f333c5a12854d440b682f5feeb63faebd202c2

Contents?: true

Size: 1.21 KB

Versions: 8

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

xml << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do
  xml.channel do
    xml.title(@title || PagesCore.config(:site_name))
    xml.link(
      url_for(controller: "pages", action: "index", only_path: false)
    )
    xml.description "Recent items"
    xml.language locale
    xml.generator "Pages"
    xml.ttl "40"
    @items.each do |item|
      xml.item do
        xml.title { xml.cdata! item.name.to_s }
        xml.link page_url(@locale, item, only_path: false)
        if PagesCore.config.rss_fulltext?
          xml.description { xml.cdata! item.body.to_html }
        else
          xml.description do
            xml.cdata!((item.extended? ? item.excerpt : item.body).to_html)
          end
        end
        xml.guid page_url(@locale, item, only_path: false)
        xml.pubDate item.published_at.to_fs(:rfc822)
        xml.tag!("dc:creator", item.author.name)
        if item.image
          xml.enclosure(
            url: dynamic_image_url(item.image, size: "2000x2000"),
            length: item.image.content_length,
            type: item.image.content_type
          )
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pages_core-3.12.1 app/views/feeds/pages.rss.builder
pages_core-3.12.0 app/views/feeds/pages.rss.builder
pages_core-3.11.3 app/views/feeds/pages.rss.builder
pages_core-3.11.2 app/views/feeds/pages.rss.builder
pages_core-3.11.1 app/views/feeds/pages.rss.builder
pages_core-3.11.0 app/views/feeds/pages.rss.builder
pages_core-3.10.2 app/views/feeds/pages.rss.builder
pages_core-3.10.1 app/views/feeds/pages.rss.builder