docs: private Optional<Path> findLayout(FileResource resource) {
  
      // handle override
      Optional<Path> maybeOverride =
          resource.getMetadata().getOverrideLayout().map(layoutDir::resolve);
      if (maybeOverride.isPresent()) {
        return maybeOverride;
      }
  
  
      Path content = resource.getPath();
  
      Collection<String> extensions = layoutEngines.keySet();
  
  
      Path relativeContent = layoutDir.resolve(contentDir.relativize(content));
  
      String templatePreExtension = "." + processedExtension(resource);//
  
      LayoutBasePath tentativeLayout = new LayoutBasePath(relativeContent.getParent(), extensions);
  
  
      Optional<Path> pathLayout =
          tentativeLayout.exist(Files.getNameWithoutExtension(relativeContent.getFileName()
              .toString()) + templatePreExtension);
  
      if (pathLayout.isPresent()) {
        return pathLayout;
      } else {
        tentativeLayout = new LayoutBasePath(tentativeLayout.basePath, extensions);
        do {
          pathLayout = tentativeLayout.exist("index" + templatePreExtension);
          if (pathLayout.isPresent()) {
            return pathLayout;
          }
          Optional<Path> maybeParent = Optional.ofNullable(tentativeLayout.basePath.getParent());
          if (!maybeParent.isPresent()) {
            break;
          }
          tentativeLayout = new LayoutBasePath(maybeParent.get(), extensions);
        } while (tentativeLayout.basePath.startsWith(layoutDir));
      }
      return Optional.empty();
    }