Sha256: 0a2d5b5d4c6274bce3cbabf1c200f742790a1e17a94f1df6738d078ecda34fbe

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 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(root_url)
    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)
        xml.description do
          xml.cdata! item.excerpt.to_html + item.body.to_html
        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

3 entries across 3 versions & 1 rubygems

Version Path
pages_core-3.12.4 app/views/feeds/pages.rss.builder
pages_core-3.12.3 app/views/feeds/pages.rss.builder
pages_core-3.12.2 app/views/feeds/pages.rss.builder