Sha256: 0cb58669ef49fc4c2fe322e90b576efff7b8f48d18dd702938258f48bc515654

Contents?: true

Size: 1.22 KB

Versions: 7

Compression:

Stored size: 1.22 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_formatted_s(: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

7 entries across 7 versions & 1 rubygems

Version Path
pages_core-3.9.2 app/views/feeds/pages.rss.builder
pages_core-3.9.1 app/views/feeds/pages.rss.builder
pages_core-3.9.0 app/views/feeds/pages.rss.builder
pages_core-3.8.3 app/views/feeds/pages.rss.builder
pages_core-3.8.2 app/views/feeds/pages.rss.builder
pages_core-3.8.1 app/views/feeds/pages.rss.builder
pages_core-3.8.0 app/views/feeds/pages.rss.builder