Sha256: f710322bb9737f475ce2d6b15316257ebc0e7ceae2d01e3133f8127a28d2ea77
Contents?: true
Size: 760 Bytes
Versions: 1
Compression:
Stored size: 760 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 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 config["title"] || config["name"] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bridgetown-feed-1.0.0 | lib/bridgetown-feed/meta-tag.rb |