Class: Middleman::Sitemap::Extensions::Redirects::RedirectResource
- Inherits:
-
Resource
- Object
- Resource
- Middleman::Sitemap::Extensions::Redirects::RedirectResource
- Defined in:
- lib/middleman-core/sitemap/extensions/redirects.rb
Instance Attribute Summary collapse
-
#output ⇒ Object
Returns the value of attribute output.
Attributes inherited from Resource
#app, #destination_path, #path, #store
Instance Method Summary collapse
-
#binary? ⇒ Boolean
def request_path @request_path end.
- #get_source_file ⇒ Object
- #ignored? ⇒ Boolean
-
#initialize(store, path, target) ⇒ RedirectResource
constructor
A new instance of RedirectResource.
- #metadata ⇒ Object
- #raw_data ⇒ Object
- #render ⇒ Object
- #template? ⇒ Boolean
Methods inherited from Resource
#add_metadata, #ext, #request_path, #source_file, #url
Methods included from ContentType
Methods included from Traversal
#children, #directory_index?, #eponymous_directory?, #eponymous_directory_path, #parent, #siblings
Constructor Details
#initialize(store, path, target) ⇒ RedirectResource
Returns a new instance of RedirectResource.
63 64 65 66 67 |
# File 'lib/middleman-core/sitemap/extensions/redirects.rb', line 63 def initialize(store, path, target) @request_path = target super(store, path) end |
Instance Attribute Details
#output ⇒ Object
Returns the value of attribute output.
61 62 63 |
# File 'lib/middleman-core/sitemap/extensions/redirects.rb', line 61 def output @output end |
Instance Method Details
#binary? ⇒ Boolean
def request_path
@request_path
end
104 105 106 |
# File 'lib/middleman-core/sitemap/extensions/redirects.rb', line 104 def binary? false end |
#get_source_file ⇒ Object
69 70 71 |
# File 'lib/middleman-core/sitemap/extensions/redirects.rb', line 69 def get_source_file nil end |
#ignored? ⇒ Boolean
112 113 114 |
# File 'lib/middleman-core/sitemap/extensions/redirects.rb', line 112 def ignored? false end |
#metadata ⇒ Object
116 117 118 |
# File 'lib/middleman-core/sitemap/extensions/redirects.rb', line 116 def @local_metadata.dup end |
#raw_data ⇒ Object
108 109 110 |
# File 'lib/middleman-core/sitemap/extensions/redirects.rb', line 108 def raw_data {} end |
#render ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/middleman-core/sitemap/extensions/redirects.rb', line 77 def render(*) url = ::Middleman::Util.url_for(store.app, @request_path, relative: false, find_resource: true ) if output output.call(path, url) else <<-END <html> <head> <meta http-equiv=refresh content="0; url=#{url}" /> <meta name="robots" content="noindex,follow" /> <meta http-equiv="cache-control" content="no-cache" /> </head> <body> </body> </html> END end end |
#template? ⇒ Boolean
73 74 75 |
# File 'lib/middleman-core/sitemap/extensions/redirects.rb', line 73 def template? true end |