```ruby
module Dimples
  module Renderable
    def render(contents, context = {})
      context[:site] ||= @site
      context.merge!(type => Hashie::Mash.new(@metadata))

      output = rendering_engine.render(Object.new, context) { contents }

      return output unless (template = @site.templates[@metadata[:layout]])
      template.render(output, context)
    end

    def rendering_engine
      @rendering_engine ||= begin
        callback = proc { @contents }

        if @path
          extension = File.extname(@path)
          options = @site.config.rendering[extension.to_sym] || {}

          Tilt.new(@path, options, &callback)
        else
          Tilt::StringTemplate.new(&callback)
        end
      end
    end
  end
end

#     def self.render_scope
#       @render_scope ||= Object.new.tap do |scope|
#         method_name = :render_template
#         scope.class.send(:define_method, method_name) do |site, template, locals = {}|
#           site.templates[template]&.render(context: locals)
#         end
#       end
#     end```

Switch the render param order, add the scope method
user
```ruby
module Dimples
  module Renderable
    def render(context = {}, body = nil)
      context[:site] ||= @site
      context.merge!(type => Hashie::Mash.new(@metadata))

      output = engine.render(scope, context) { body }

      return output unless (template = @site.templates[@metadata[:layout]])
      template.render(context, output)
    end

    def scope
      @scope ||= Object.new.tap do |scope|
        scope.instance_variable_set(:@site, @site)
        scope.instance_variable_set(:@metadata, {})

        scope.class.send(:define_method, :render) do |layout, locals = {}|
          @site.templates[layout]&.render(locals)
        end
      end
    end

    def engine
      @engine ||= begin
        callback = proc { @contents }

        if @path
          extension = File.extname(@path)
          options = @site.config.rendering[extension.to_sym] || {}

          Tilt.new(@path, options, &callback)
        else
          Tilt::StringTemplate.new(&callback)
        end
      end
    end
  end
end

```
assistant