Some tweaks to get blog working
This commit is contained in:
parent
d99b922e67
commit
8c02eb2a26
7 changed files with 25 additions and 1 deletions
|
@ -12,7 +12,7 @@ require 'middleman-core/util/data'
|
|||
module Middleman::CoreExtensions
|
||||
class FrontMatter < ::Middleman::Extension
|
||||
# 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)
|
||||
super
|
||||
|
|
|
@ -3,6 +3,8 @@ module Middleman
|
|||
module Extensions
|
||||
# Class to handle managing ignores
|
||||
class Ignores < Extension
|
||||
self.resource_list_manipulator_priority = 0
|
||||
|
||||
# Expose `create_ignore` as `app.ignore`
|
||||
expose_to_application ignore: :create_ignore
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@ module Middleman
|
|||
module Sitemap
|
||||
module Extensions
|
||||
class OnDisk < Extension
|
||||
self.resource_list_manipulator_priority = 0
|
||||
|
||||
def initialize(app, config={}, &block)
|
||||
super
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@ module Middleman
|
|||
# Manages the list of proxy configurations and manipulates the sitemap
|
||||
# to include new resources based on those configurations
|
||||
class Proxies < Extension
|
||||
self.resource_list_manipulator_priority = 0
|
||||
|
||||
# Expose `create_proxy` as `app.proxy`
|
||||
expose_to_application proxy: :create_proxy
|
||||
|
||||
|
@ -83,7 +85,16 @@ module Middleman
|
|||
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
|
||||
Contract String
|
||||
attr_reader :target
|
||||
|
||||
# Initialize resource with parent store and URL
|
||||
# @param [Middleman::Sitemap::Store] store
|
||||
# @param [String] path
|
||||
|
@ -119,6 +130,10 @@ module Middleman
|
|||
target_resource.file_descriptor
|
||||
end
|
||||
|
||||
def metadata
|
||||
target_resource.metadata.deep_merge super
|
||||
end
|
||||
|
||||
Contract Maybe[String]
|
||||
def content_type
|
||||
mime_type = super
|
||||
|
|
|
@ -7,6 +7,8 @@ module Middleman
|
|||
# Manages the list of proxy configurations and manipulates the sitemap
|
||||
# to include new resources based on those configurations
|
||||
class Redirects < Extension
|
||||
self.resource_list_manipulator_priority = 0
|
||||
|
||||
# Expose `create_redirect` to config as `redirect`
|
||||
expose_to_config redirect: :create_redirect
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ module Middleman
|
|||
module Sitemap
|
||||
module Extensions
|
||||
class RequestEndpoints < Extension
|
||||
self.resource_list_manipulator_priority = 0
|
||||
|
||||
# Expose `create_endpoint` to config as `endpoint`
|
||||
expose_to_config endpoint: :create_endpoint
|
||||
|
||||
|
|
|
@ -188,6 +188,7 @@ module Middleman
|
|||
@app.logger.debug '== Rebuilding resource list'
|
||||
|
||||
@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)
|
||||
|
||||
# Reset lookup cache
|
||||
|
|
Loading…
Reference in a new issue