Sha256: 2022e16e848e2b82be69bd9eff85377cfd7f320b6bafbc815b59d547f01e8dbd

Contents?: true

Size: 581 Bytes

Versions: 1

Compression:

Stored size: 581 Bytes

Contents

require 'middleman-core'

module Middleman
  class AliasExtension < Middleman::Extension
    def initialize(app, options_hash={}, &block)
      super
    end

    def manipulate_resource_list(resources)
      resources.each do |resource|
        if resource.data["alias"]
          Sitemap::Resource.new(@app.sitemap, resource.data["alias"]).tap do |p|
            p.proxy_to("alias.html")
            p.add_metadata locals: {
              destination: resource.url
            }
            resources.push p
          end
        end
      end
      resources
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
middleman-alias-0.0.2 lib/middleman-alias/extension.rb