Some tweaks to get blog working
This commit is contained in:
parent
d99b922e67
commit
8c02eb2a26
|
@ -12,7 +12,7 @@ require 'middleman-core/util/data'
|
||||||
module Middleman::CoreExtensions
|
module Middleman::CoreExtensions
|
||||||
class FrontMatter < ::Middleman::Extension
|
class FrontMatter < ::Middleman::Extension
|
||||||
# Try to run after routing but before directory_indexes
|
# Try to run after routing but before directory_indexes
|
||||||
self.resource_list_manipulator_priority = 90
|
self.resource_list_manipulator_priority = 10
|
||||||
|
|
||||||
def initialize(app, options_hash={}, &block)
|
def initialize(app, options_hash={}, &block)
|
||||||
super
|
super
|
||||||
|
|
|
@ -3,6 +3,8 @@ module Middleman
|
||||||
module Extensions
|
module Extensions
|
||||||
# Class to handle managing ignores
|
# Class to handle managing ignores
|
||||||
class Ignores < Extension
|
class Ignores < Extension
|
||||||
|
self.resource_list_manipulator_priority = 0
|
||||||
|
|
||||||
# Expose `create_ignore` as `app.ignore`
|
# Expose `create_ignore` as `app.ignore`
|
||||||
expose_to_application ignore: :create_ignore
|
expose_to_application ignore: :create_ignore
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ module Middleman
|
||||||
module Sitemap
|
module Sitemap
|
||||||
module Extensions
|
module Extensions
|
||||||
class OnDisk < Extension
|
class OnDisk < Extension
|
||||||
|
self.resource_list_manipulator_priority = 0
|
||||||
|
|
||||||
def initialize(app, config={}, &block)
|
def initialize(app, config={}, &block)
|
||||||
super
|
super
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@ module Middleman
|
||||||
# Manages the list of proxy configurations and manipulates the sitemap
|
# Manages the list of proxy configurations and manipulates the sitemap
|
||||||
# to include new resources based on those configurations
|
# to include new resources based on those configurations
|
||||||
class Proxies < Extension
|
class Proxies < Extension
|
||||||
|
self.resource_list_manipulator_priority = 0
|
||||||
|
|
||||||
# Expose `create_proxy` as `app.proxy`
|
# Expose `create_proxy` as `app.proxy`
|
||||||
expose_to_application proxy: :create_proxy
|
expose_to_application proxy: :create_proxy
|
||||||
|
|
||||||
|
@ -83,7 +85,16 @@ module Middleman
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class Resource
|
||||||
|
def proxy_to(path)
|
||||||
|
throw "Resource#proxy_to has been removed. Use ProxyResource class instead."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class ProxyResource < ::Middleman::Sitemap::Resource
|
class ProxyResource < ::Middleman::Sitemap::Resource
|
||||||
|
Contract String
|
||||||
|
attr_reader :target
|
||||||
|
|
||||||
# Initialize resource with parent store and URL
|
# Initialize resource with parent store and URL
|
||||||
# @param [Middleman::Sitemap::Store] store
|
# @param [Middleman::Sitemap::Store] store
|
||||||
# @param [String] path
|
# @param [String] path
|
||||||
|
@ -119,6 +130,10 @@ module Middleman
|
||||||
target_resource.file_descriptor
|
target_resource.file_descriptor
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def metadata
|
||||||
|
target_resource.metadata.deep_merge super
|
||||||
|
end
|
||||||
|
|
||||||
Contract Maybe[String]
|
Contract Maybe[String]
|
||||||
def content_type
|
def content_type
|
||||||
mime_type = super
|
mime_type = super
|
||||||
|
|
|
@ -7,6 +7,8 @@ module Middleman
|
||||||
# Manages the list of proxy configurations and manipulates the sitemap
|
# Manages the list of proxy configurations and manipulates the sitemap
|
||||||
# to include new resources based on those configurations
|
# to include new resources based on those configurations
|
||||||
class Redirects < Extension
|
class Redirects < Extension
|
||||||
|
self.resource_list_manipulator_priority = 0
|
||||||
|
|
||||||
# Expose `create_redirect` to config as `redirect`
|
# Expose `create_redirect` to config as `redirect`
|
||||||
expose_to_config redirect: :create_redirect
|
expose_to_config redirect: :create_redirect
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@ module Middleman
|
||||||
module Sitemap
|
module Sitemap
|
||||||
module Extensions
|
module Extensions
|
||||||
class RequestEndpoints < Extension
|
class RequestEndpoints < Extension
|
||||||
|
self.resource_list_manipulator_priority = 0
|
||||||
|
|
||||||
# Expose `create_endpoint` to config as `endpoint`
|
# Expose `create_endpoint` to config as `endpoint`
|
||||||
expose_to_config endpoint: :create_endpoint
|
expose_to_config endpoint: :create_endpoint
|
||||||
|
|
||||||
|
|
|
@ -188,6 +188,7 @@ module Middleman
|
||||||
@app.logger.debug '== Rebuilding resource list'
|
@app.logger.debug '== Rebuilding resource list'
|
||||||
|
|
||||||
@resources = @resource_list_manipulators.reduce([]) do |result, m|
|
@resources = @resource_list_manipulators.reduce([]) do |result, m|
|
||||||
|
@app.logger.debug "== Running manipulator: #{m[:name]}"
|
||||||
newres = m[:manipulator].send(m[:custom_name] || :manipulate_resource_list, result)
|
newres = m[:manipulator].send(m[:custom_name] || :manipulate_resource_list, result)
|
||||||
|
|
||||||
# Reset lookup cache
|
# Reset lookup cache
|
||||||
|
|
Loading…
Reference in a new issue