Sha256: 477e06d7fc540ee26300df1540e9051b25a2f08386066a40d27cc31068de64b2
Contents?: true
Size: 1.03 KB
Versions: 3
Compression:
Stored size: 1.03 KB
Contents
# frozen_string_literal: true module BridgetownFeed class Builder < Bridgetown::Builder include Bridgetown::Filters::URLFilters Context = Struct.new(:registers) def build @context = Context.new({ site: site }) helper "feed_meta", :generate_link_tag liquid_tag "feed_meta", :generate_link_tag end def generate_link_tag(*) attrs = attributes.map { |k, v| %(#{k}="#{v}") }.join(" ") tag_output = "<link #{attrs} />" tag_output.respond_to?(:html_safe) ? tag_output.html_safe : tag_output end private def config @config ||= site.config end def metadata @metadata ||= site.data["site_metadata"] end def attributes { type: "application/atom+xml", rel: "alternate", href: absolute_url(path), title: title, }.keep_if { |_, v| v } end def path config.dig("feed", "path") || "feed.xml" end def title metadata["title"] || metadata["name"] end end end BridgetownFeed::Builder.register
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bridgetown-feed-2.1.0 | lib/bridgetown-feed/builder.rb |
bridgetown-feed-2.0.1 | lib/bridgetown-feed/builder.rb |
bridgetown-feed-2.0.0 | lib/bridgetown-feed/builder.rb |