Some tweaks to get blog working

This commit is contained in:
Thomas Reynolds 2015-09-14 17:37:35 -07:00
parent d99b922e67
commit 8c02eb2a26
7 changed files with 25 additions and 1 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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