Some changes for the default theme

pull/20/head
Jens Pelzetter 2022-01-20 14:07:41 +01:00
parent f8e33d101b
commit 0c930877d1
7 changed files with 2362 additions and 14 deletions

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 175 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 174 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 180 KiB

View File

@ -1,14 +1,39 @@
<#import "./main.html.ftl" as main> <#import "./main.html.ftl" as main>
<@main.librecms> <@main.librecms>
<h1>Index page</h1> <div class="container">
<p>This theme works.</p> <div class="bg-light mb-4 rounded-3">
<dl> <div class="container-fluid py-5">
<dt>application</dt> <h1 class="display-5 fw-bold">
<dd>${application}</dd> LibreCMS
<dt>themeUrl</dt> </h1>
<dd>${themeUrl}</dd> <p>
<dt>view</dt> No index item has been defined.
<dd>${view!""}</dd> </p>
</dl> <a class="btn btn-primary btn-lg"
href="https://www.libreccm.org"
type="button">
Find out more
</a>
</div>
</div>
<#if CmsPagesCategorizedItemModel.contentItem??>
Category has an index item
<#else>
Category has no index item
</#if>
<h2>Index page</h2>
<p>This theme works.</p>
<dl>
<dt>application</dt>
<dd>${application}</dd>
<dt>themeUrl</dt>
<dd>${themeUrl}</dd>
<dt>view</dt>
<dd>${view!""}</dd>
</dl>
</div>
</@main.librecms> </@main.librecms>

View File

@ -7,9 +7,43 @@
<title>Default Template</title> <title>Default Template</title>
</head> </head>
<body> <body>
<div class="container"> <header>
<nav class="navbar navbar-expand-lg navbar-expand navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand"
href="/pages">
<img class="theme-logo img-fluid"
src="${themeUrl}/images/librecms.svg" />
</a>
<button aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation"
class="navbar-toggler"
data-bs-toggle="collapse"
data-bs-target="#navbar-items"
type="button">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse"
id="navbar-items">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<#list CmsPagesCategoryModel.categoryTree.subCategories as category>
<li ${category.selected?then("aria-selected=\"page\"","")}
class="nav-item ${category.selected?then( "active","")}">
<a class="nav-link"
href="${category.categoryPath}">
${category.title}
</a>
</li>
</#list>
</ul>
</div>
</div>
</nav>
</header>
<main>
<#nested> <#nested>
</div> </main>
</body> </body>
</html> </html>
</#macro> </#macro>

View File

@ -0,0 +1,3 @@
a.navbar-brand {
max-width: 15%;
}

View File

@ -6,6 +6,8 @@ import * as fsPromises from "fs/promises";
import * as mime from "mime-types"; import * as mime from "mime-types";
import { fileTypeFromFile, FileTypeResult } from "file-type"; import { fileTypeFromFile, FileTypeResult } from "file-type";
const AMBIGOUS_FILE_TYPES = ["application/xml"];
console.log("Static Theme Builder"); console.log("Static Theme Builder");
if (process.argv.length < 3) { if (process.argv.length < 3) {
@ -143,7 +145,10 @@ function mapFileTypeResultToMimeType(
fileTypeResult: FileTypeResult | undefined fileTypeResult: FileTypeResult | undefined
): string { ): string {
if (fileTypeResult) { if (fileTypeResult) {
if (fileTypeResult.mime) { if (
fileTypeResult.mime &&
!AMBIGOUS_FILE_TYPES.includes(fileTypeResult.mime)
) {
return fileTypeResult.mime; return fileTypeResult.mime;
} else { } else {
const result = mime.lookup(name); const result = mime.lookup(name);