This commit is contained in:
@@ -8,20 +8,17 @@ weight = 1
|
||||
[[main]]
|
||||
name = "About me"
|
||||
pageRef = "about"
|
||||
identifier = "3mwQIHQJHy"
|
||||
weight = 2
|
||||
|
||||
[[main]]
|
||||
name = "Blog"
|
||||
pre = "pencil"
|
||||
pageRef = "blog"
|
||||
identifier = "Wlbt6D8Nvp"
|
||||
pageRef = "posts"
|
||||
weight = 9_999
|
||||
|
||||
[[main]]
|
||||
name = "Bio"
|
||||
pageRef = "bio"
|
||||
identifier = "7c1RZHAEl4"
|
||||
weight = 3
|
||||
|
||||
|
||||
@@ -31,19 +28,16 @@ none = "none"
|
||||
[[footer]]
|
||||
name = "Impressum"
|
||||
pageRef = "impressum"
|
||||
identifier = "3C57lKh0ZG"
|
||||
weight = 1
|
||||
|
||||
[[footer]]
|
||||
name = "Contact"
|
||||
pageRef = "contact"
|
||||
identifier = "ssriowfp"
|
||||
weight = 3
|
||||
|
||||
[[footer]]
|
||||
name = "Privacy Policy"
|
||||
pageRef = "privacy"
|
||||
identifier = "siowfp"
|
||||
weight = 2
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ disableImageOptimization = false
|
||||
disableImageOptimizationMD = false
|
||||
disableTextInHeader = false
|
||||
|
||||
mainSections = ["blog"]
|
||||
mainSections = ["posts"]
|
||||
|
||||
giteaDefaultServer = "https://gitea.benno-lorenz.com"
|
||||
firebase = { }
|
||||
@@ -44,14 +44,14 @@ showScrollToTop = true
|
||||
layout = "background"
|
||||
homepageImage = "background.svg"
|
||||
|
||||
showRecent = true
|
||||
showRecent = false
|
||||
showRecentItems = 5
|
||||
cardView = true
|
||||
cardViewScreenWidth = true
|
||||
layoutBackgroundBlur = false
|
||||
|
||||
showMoreLink = true
|
||||
showMoreLinkDest = "/blog"
|
||||
showMoreLinkDest = "/posts"
|
||||
disableHeroImagefilter = true
|
||||
|
||||
[article]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
description:
|
||||
|
||||
description: "This is the main Homepage"
|
||||
|
||||
---
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ tags:
|
||||
- space
|
||||
image: pexels-optical-chemist-340351297-31986005.jpg
|
||||
type: blogpost
|
||||
categories: ["blog", "posts"]
|
||||
|
||||
---
|
||||
## A sub-title
|
||||
|
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 1.8 MiB |
|
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 1.8 MiB |
@@ -8,8 +8,7 @@ date: 2025-06-01T23:15:00.000Z
|
||||
draft: false
|
||||
type: blogpost
|
||||
image: featuredcat.jpg
|
||||
categories:
|
||||
- Test
|
||||
categories: ["blog", "posts"]
|
||||
---
|
||||
# Lorem Ipsum Dolor
|
||||
|
||||
@@ -28,11 +28,13 @@ collections:
|
||||
label: "Authors",
|
||||
name: "authors",
|
||||
widget: "select",
|
||||
multiple: true,
|
||||
options: ["bob", "jane", "peter", "kate"],
|
||||
multiple: False,
|
||||
options: ["Benno Lorenz"],
|
||||
}
|
||||
- { label: "Date", name: "date", widget: "datetime" }
|
||||
- { label: "Draft", name: "draft", widget: "boolean", default: true }
|
||||
- { label: "Cover Image", name: "image", widget: "image" }
|
||||
- { label: "Cover Image", name: "image", widget: "prefixed-image" }
|
||||
- { label: "Cover Style", name: "cover_style", widget: "select", options: ["basic", "big", "background", "thumbAndBackground"], default: "default" }
|
||||
- { label: "images", name: "images", widget: "image", multiple: true }
|
||||
- { label: "Body", name: "body", widget: "markdown" }
|
||||
|
||||
|
||||
@@ -11,5 +11,6 @@
|
||||
<body>
|
||||
<!-- Include the script that builds the page and powers Decap CMS -->
|
||||
<script src="https://unpkg.com/decap-cms@^3.0.0/dist/decap-cms.js"></script>
|
||||
<script src="prefixed-image-widget.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
38
static/admin/prefixed-image-widget.js
Normal file
38
static/admin/prefixed-image-widget.js
Normal file
@@ -0,0 +1,38 @@
|
||||
import React from "react";
|
||||
|
||||
class PrefixedImageControl extends React.Component {
|
||||
handleChange = async (event) => {
|
||||
const file = event.target.files[0];
|
||||
if (!file) return;
|
||||
|
||||
// Add your prefix here
|
||||
const prefix = "feature-";
|
||||
const newFile = new File([file], prefix + file.name, { type: file.type });
|
||||
|
||||
// Use Decap's media library to persist the file
|
||||
const { onChange, mediaPaths, field } = this.props;
|
||||
const uploaded = await this.props.mediaLibrary.persistMedia(newFile);
|
||||
|
||||
// Save the public path
|
||||
onChange(uploaded.public_path || uploaded.url);
|
||||
};
|
||||
|
||||
render() {
|
||||
const value = this.props.value || "";
|
||||
return (
|
||||
<div>
|
||||
<input type="file" accept="image/*" onChange={this.handleChange} />
|
||||
{value && <img src={value} alt="" style={{ maxWidth: "200px" }} />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const PrefixedImageWidget = {
|
||||
name: "prefixed-image",
|
||||
controlComponent: PrefixedImageControl,
|
||||
previewComponent: ({ value }) =>
|
||||
value ? <img src={value} alt="" style={{ maxWidth: "200px" }} /> : null,
|
||||
};
|
||||
|
||||
window.CMS.registerWidget(PrefixedImageWidget.name, PrefixedImageWidget.controlComponent, PrefixedImageWidget.previewComponent);
|
||||
Reference in New Issue
Block a user