Package liqp.tags

Class IncludeRelative


public class IncludeRelative extends Include
   class IncludeRelativeTag < IncludeTag
       def tag_includes_dirs(context)
         Array(page_path(context)).freeze
       end

       def page_path(context)
         page, site = context.registers.values_at(:page, :site)
         return site.source unless page

         site.in_source_dir File.dirname(resource_path(page, site))
       end

       private

       def resource_path(page, site)
         path = page["path"]
         path = File.join(site.config["collections_dir"], path) if page["collection"]
         path.delete_suffix("/#excerpt")
       end
     end