Skip to content

make()#

Static alias for the constructor.

/** @param string|(Closure(): string)|(Closure(static): string)|null $contents */
InMemoryPage::make(string|(Closure(): string)|(Closure(static):, Hyde\Markdown\Models\FrontMatter|array $matter, Closure|string|null $contents, ?string $view, bool $localizable): static

outputPath()#

Qualify a page identifier into a target output file path.

The configured output directory is applied to all identifiers. Identifiers with a file extension retain it, while identifiers without one get the configured output extension (.html by default).

InMemoryPage::outputPath(string $identifier): string

__construct()#

Create a new in-memory (virtual) page instance.

Pass literal contents or a closure to $contents, or pass a registered Laravel view key or Blade file path to $view.

Contents and views cannot be used together. Omit both to create an empty page. An empty view value is treated as no view.

View values ending in .blade.php are treated as Blade file paths. Other values are treated as registered Laravel view keys.

  • Parameter string)|(Closure(static):: string)|null $contents
  • Parameter $localizable: Whether a localized site compiles the page once for each language.
$page = new InMemoryPage(string $identifier, FrontMatter|array $matter, string|(Closure(): string)|(Closure(static):, string|null $view, bool $localizable): void
  • Throws: InvalidArgumentException If both contents and a view are supplied.

isLocalizable()#

Determine whether the page is compiled once for each language of a localized site.

Pages presenting content are, as that content is what differs between languages. Pages describing the site as a whole, such as its sitemap or feed, are not, as there is only ever one of them, and it belongs in the webroot rather than in a language directory.

$page->isLocalizable(): bool

getContents()#

Get the literal contents or invoke the configured content closure.

$page->getContents(): string

getBladeView()#

Get the Blade view key or file path, or an empty string when none is configured.

$page->getBladeView(): string

compile()#

Get the contents that will be saved to disk for this page.

$page->compile(): string