Sha256: 964eba2cb5e5e6466cde8ca6928630f398d7b77a881be454dfc617167dd30503
Contents?: true
Size: 858 Bytes
Versions: 3
Compression:
Stored size: 858 Bytes
Contents
# frozen_string_literal: true module BridgetownFeed class MetaTag < Liquid::Tag # Use Bridgetown's native relative_url filter include Bridgetown::Filters::URLFilters def render(context) @context = context attrs = attributes.map { |k, v| %(#{k}="#{v}") }.join(" ") "<link #{attrs} />" end private def config @config ||= @context.registers[:site].config end def metadata @metadata ||= @context.registers[: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
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bridgetown-feed-1.1.2 | lib/bridgetown-feed/meta-tag.rb |
bridgetown-feed-1.1.1 | lib/bridgetown-feed/meta-tag.rb |
bridgetown-feed-1.1.0 | lib/bridgetown-feed/meta-tag.rb |