sourceDisk = Storage::disk('source'); $this->targetDisk = Storage::disk('build_local'); } protected function readSite() { $files = $this->sourceDisk->files(recursive: true); foreach (self::IGNORED_DIRECTORIES as $ignore) { $files = array_filter($files, fn($path) => !str_starts_with($path, $ignore)); } $pages = []; // Set up a structure foreach ($files as $f) { $pages[] = [ 'path' => $f, 'name' => basename($f), 'source' => Storage::disk('source')->path($f), 'output_path' => $this->getOutputPath($f), 'extension' => $this->getFileExtension($f) ]; } } public function getOutputPath(string $filename): string { $indexFiles = ['index.md', 'index.blade.php']; $baseDirectory = Str::of($filename)->remove(basename($filename))->trim('/')->toString(); if (in_array(basename($filename), $indexFiles)) { return join_paths($baseDirectory, "index.html"); } return join_paths($baseDirectory, "{$this->slugFromFilename($filename)}", "index.html"); } public function getFileExtension($filename): string { // Check for .blade.php first if (str_ends_with($filename, '.blade.php')) { return 'blade.php'; } // Fall back to regular extension return pathinfo($filename, PATHINFO_EXTENSION); } /** * Parse all content collections and sub collections. * Return a collection of ContentCollection objects * with the correct data populated based on front * matter and config. * * @return Collection */ public function collections(): Collection {} }