module Middleman::Sitemap::Extensions::Proxies::ResourceInstanceMethods
Attributes
proxied_to[R]
The path of the page this page is proxied to, or nil if it’s not proxied. @return [String]
Public Instance Methods
content_type()
click to toggle source
Calls superclass method
# File lib/middleman-core/sitemap/extensions/proxies.rb, line 65 def content_type mime_type = super return mime_type if mime_type if proxy? proxied_to_resource.content_type else nil end end
get_source_file()
click to toggle source
rubocop:disable AccessorMethodName
Calls superclass method
# File lib/middleman-core/sitemap/extensions/proxies.rb, line 57 def get_source_file if proxy? proxied_to_resource.source_file else super end end
proxied_to_resource()
click to toggle source
The resource for the page this page is proxied to. Throws an exception if there is no resource. @return [Sitemap::Resource]
# File lib/middleman-core/sitemap/extensions/proxies.rb, line 42 def proxied_to_resource proxy_resource = store.find_resource_by_path(proxied_to) unless proxy_resource raise "Path #{path} proxies to unknown file #{proxied_to}:#{store.resources.map(&:path)}" end if proxy_resource.proxy? raise "You can't proxy #{path} to #{proxied_to} which is itself a proxy." end proxy_resource end
proxy?()
click to toggle source
Whether this page is a proxy rubocop:disable TrivialAccessors @return [Boolean]
# File lib/middleman-core/sitemap/extensions/proxies.rb, line 22 def proxy? @proxied_to end
proxy_to(target)
click to toggle source
Set this page to proxy to a target path @param [String] target @return [void]
# File lib/middleman-core/sitemap/extensions/proxies.rb, line 29 def proxy_to(target) target = ::Middleman::Util.normalize_path(target) raise "You can't proxy #{path} to itself!" if target == path @proxied_to = target end