Minor tweak

This commit is contained in:
Belle Aerni 2023-03-30 17:02:12 -07:00
parent 226d100673
commit 1770d5376a
5 changed files with 10 additions and 8 deletions

View file

@ -63,12 +63,8 @@ class AntCMS
*/
public static function getPageLayout(string $theme = null, string $currentPage = '')
{
$siteInfo = AntCMS::getSiteInfo();
$pageTemplate = self::getThemeTemplate('default', $theme);
$pageTemplate = str_replace('<!--AntCMS-Navigation-->', AntPages::generateNavigation(self::getThemeTemplate('nav', $theme), $currentPage), $pageTemplate);
return $pageTemplate = str_replace('<!--AntCMS-SiteTitle-->', $siteInfo['siteTitle'], $pageTemplate);
return str_replace('<!--AntCMS-Navigation-->', AntPages::generateNavigation(self::getThemeTemplate('nav', $theme), $currentPage), $pageTemplate);
}
/**

View file

@ -30,6 +30,9 @@ class AntTwig
{
$subLayout = AntCMS::getThemeTemplate($layout, $this->theme);
$mainLayout = AntCMS::getPageLayout($this->theme);
$siteInfo = AntCMS::getSiteInfo();
$params['AntCMSSiteTitle'] = $siteInfo['siteTitle'];
$params['AntCMSBody'] = $this->twigEnvironment->render($subLayout, $params);
return $this->twigEnvironment->render($mainLayout, $params);
@ -37,6 +40,9 @@ class AntTwig
public function renderWithTiwg(string $content = '', array $params = array())
{
$siteInfo = AntCMS::getSiteInfo();
$params['AntCMSSiteTitle'] = $siteInfo['siteTitle'];
return $this->twigEnvironment->render($content, $params);
}
}

View file

@ -18,7 +18,7 @@
<!-- Navigation -->
<nav class="navbar navbar-expand-lg">
<div class="container-fluid">
<a class="navbar-brand" href="{{ ""|absUrl }}"><!--AntCMS-SiteTitle--></a>
<a class="navbar-brand" href="{{ ""|absUrl }}">{{ AntCMSSiteTitle}}</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>

View file

@ -1,7 +1,7 @@
{% for page in pages %}
{% if page.active %}
<li class="nav-item">
<a class="nav-link active" href="{{ page.url }}">{{ page.pageTitle }}</a>
<a class="nav-link active" aria-current="page" href="{{ page.url }}">{{ page.pageTitle }}</a>
</li>
{% else %}
<li class="nav-item">

View file

@ -18,7 +18,7 @@
<nav class="p-3 border-gray-200 bg-gray-100 dark:bg-zinc-900 dark:border-gray-700">
<div class="container flex flex-wrap items-center justify-between mx-auto">
<a href="{{ ""|absUrl }}" class="flex items-center">
<span class="self-center text-xl font-semibold whitespace-nowrap dark:text-white"><!--AntCMS-SiteTitle--></span>
<span class="self-center text-xl font-semibold whitespace-nowrap dark:text-white">{{ AntCMSSiteTitle}}</span>
</a>
<button data-collapse-toggle="navbar-solid-bg" type="button"
class="inline-flex items-center p-2 ml-3 text-sm text-gray-500 rounded-lg md:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600"