module Middleman::Sitemap::Extensions::Proxies::ResourceInstanceMethods

Public Instance Methods

get_source_file() click to toggle source
# File lib/middleman-core/sitemap/extensions/proxies.rb, line 55
def get_source_file
  if proxy?
    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.source_file
  end
end
proxied_to() click to toggle source

The path of the page this page is proxied to, or nil if it’s not proxied. @return [String]

# File lib/middleman-core/sitemap/extensions/proxies.rb, line 41
def proxied_to
  @proxied_to
end
proxy?() click to toggle source

Whether this page is a proxy @return [Boolean]

# File lib/middleman-core/sitemap/extensions/proxies.rb, line 26
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 33
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
template?() click to toggle source

Whether this page has a template file @return [Boolean]

Calls superclass method
# File lib/middleman-core/sitemap/extensions/proxies.rb, line 47
def template?
  if proxy?
    store.find_resource_by_path(proxied_to).template?
  else
    super
  end
end