Module: Middleman::Sitemap::Extensions::Proxies::ResourceInstanceMethods

Defined in:
middleman-core/lib/middleman-core/sitemap/extensions/proxies.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) get_source_file



53
54
55
56
57
58
59
60
61
62
63
# File 'middleman-core/lib/middleman-core/sitemap/extensions/proxies.rb', line 53

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}"
    end

    proxy_resource.source_file
  end
end

- (String) proxied_to

The path of the page this page is proxied to, or nil if it's not proxied.

Returns:

  • (String)


39
40
41
# File 'middleman-core/lib/middleman-core/sitemap/extensions/proxies.rb', line 39

def proxied_to
  @proxied_to
end

- (Boolean) proxy?

Whether this page is a proxy

Returns:

  • (Boolean)


26
27
28
# File 'middleman-core/lib/middleman-core/sitemap/extensions/proxies.rb', line 26

def proxy?
  !!@proxied_to
end

- (void) proxy_to(target)

This method returns an undefined value.

Set this page to proxy to a target path

Parameters:

  • target (String)


33
34
35
# File 'middleman-core/lib/middleman-core/sitemap/extensions/proxies.rb', line 33

def proxy_to(target)
  @proxied_to = target
end

- (Boolean) template?

Whether this page has a template file

Returns:

  • (Boolean)


45
46
47
48
49
50
51
# File 'middleman-core/lib/middleman-core/sitemap/extensions/proxies.rb', line 45

def template?
  if proxy?
    store.find_resource_by_path(proxied_to).template?
  else
    super
  end
end