1
0
mirror of https://github.com/typemill/typemill.git synced 2025-01-17 05:18:19 +01:00

V2.1.0 - New reference feature in meta tabs

This commit is contained in:
trendschau 2023-12-18 12:58:55 +01:00
parent 648d70448b
commit d4dedecfd1
12 changed files with 70 additions and 53 deletions

7
.gitignore vendored
View File

@ -1,10 +1,11 @@
cache/sitemap.xml
content/index.yaml
content/00-welcome/index.yaml
content/00-welcome/00-setup.yaml
content/00-welcome/00-setup-your-website.yaml
content/00-welcome/01-write-content.yaml
content/00-welcome/02-get-help.yaml
content/00-welcome/03-markdown-test.yaml
content/00-welcome/02-manage-access.yaml
content/00-welcome/03-get-help.yaml
content/00-welcome/04-markdown-test.yaml
content/01-cyanine-theme/index.yaml
content/01-cyanine-theme/00-landingpage.yaml
content/01-cyanine-theme/01-colors-and-fonts.yaml

View File

@ -9,3 +9,4 @@ meta:
time: 15-18-48
hide: false
noindex: false
author: Sebastian

View File

@ -1,16 +0,0 @@
meta:
navtitle: 'manage access'
title: 'Manage access'
description: ' Restrict Access for the Website'
heroimage: null
heroimagealt: null
owner: Sebastian
author: null
allowedrole: null
alloweduser: null
manualdate: null
modified: '2023-05-06'
created: '2023-06-12'
time: 22-36-36
hide: false
noindex: false

View File

@ -1,10 +0,0 @@
meta:
navtitle: 'write content'
title: 'Write Content'
description: 'Typemill provides easy and intuitive authoring tools and we work hard to create a good author experience. With the interactive navigation you can create pages'
owner: Sebastian
modified: '2023-05-11'
created: '2023-06-12'
time: 22-09-48
hide: false
noindex: false

View File

@ -5,7 +5,7 @@ meta:
heroimage: null
heroimagealt: null
owner: trendschau
author: null
author: Sebastian
allowedrole: null
alloweduser: null
manualdate: null

View File

@ -5,7 +5,7 @@ meta:
heroimage: null
heroimagealt: null
owner: Sebastian
author: null
author: Sebastian
allowedrole: null
alloweduser: null
manualdate: null

File diff suppressed because one or more lines are too long

View File

@ -10,17 +10,17 @@
noindex: false
path: /00-welcome/00-setup-your-website.md
keyPath: '0.0'
/welcome/manage-access:
navtitle: 'manage access'
hide: false
noindex: false
path: /00-welcome/01-manage-access.md
keyPath: '0.1'
/welcome/write-content:
navtitle: 'write content'
hide: false
noindex: false
path: /00-welcome/02-write-content.md
path: /00-welcome/01-write-content.md
keyPath: '0.1'
/welcome/manage-access:
navtitle: 'manage access'
hide: false
noindex: false
path: /00-welcome/02-manage-access.md
keyPath: '0.2'
/welcome/get-help:
navtitle: 'get help'

View File

@ -134,6 +134,44 @@ class ControllerWebFrontend extends Controller
$metadata = $this->c->get('dispatcher')->dispatch(new OnMetaLoaded($metadata),'onMetaLoaded')->getData();
# REFERENCE FEATURE
if(isset($metadata['meta']['referencetype']) && $metadata['meta']['referencetype'] != 'disable')
{
$referenceurl = rtrim($urlinfo['baseurl'], '/') . '/' . trim($metadata['meta']['reference'], '/');
switch ($metadata['meta']['referencetype']) {
case 'redirect301':
return $response->withHeader('Location', $referenceurl)->withStatus(301);
break;
case 'redirect302':
return $response->withHeader('Location', $referenceurl)->withStatus(302);
break;
case 'outlink':
return $response->withHeader('Location', $metadata['meta']['reference'])->withStatus(301);
break;
case 'copy':
$refpageinfo = $extendedNavigation[$metadata['meta']['reference']] ?? false;
if(!$refpageinfo)
{
return $this->c->get('view')->render($response->withStatus(404), '404.twig', [
'title' => 'Referenced page not found',
'description' => 'We did not find the page that has been referenced. Please inform the website owner to fix it in meta reference.'
]);
}
$refKeyPathArray = explode(".", $refpageinfo['keyPath']);
$refItem = $navigation->getItemWithKeyPath($draftNavigation, $refKeyPathArray);
# GET THE CONTENT FROM REFENCED PAGE
$liveMarkdown = $content->getLiveMarkdown($refItem);
$liveMarkdown = $this->c->get('dispatcher')->dispatch(new OnMarkdownLoaded($liveMarkdown), 'onMarkdownLoaded')->getData();
$markdownArray = $content->markdownTextToArray($liveMarkdown);
break;
}
}
# CHECK ACCESS RESTRICTIONS
$restricted = $this->checkRestrictions($metadata['meta'], $username, $userrole);
if($restricted)

View File

@ -78,20 +78,23 @@ meta:
hidden: true
css: hidden
pattern: '[0-9][0-9]-[0-9][0-9]-[0-9][0-9]'
# fieldsetreference:
# type: fieldset
# legend: Reference
# fields:
# reference:
# type: text
# label: Reference to page
# maxlength: 60
# referencetype:
# type: radio
# label: Type of reference
# options:
# copy: Copy (copy the content of the referenced page)
# redirect: Redirect (redirect the user to the referenced page)
fieldsetreference:
type: fieldset
legend: Reference
fields:
reference:
type: text
label: Reference to page
maxlength: 200
referencetype:
type: radio
label: Type of reference
options:
disable: Disable
redirect301: PERMANENT REDIRECT (301) the user to the referenced internal page
redirect302: TEMPORARY REDIRECT (302) the user to the referenced internal page
copy: COPY the content of the referenced internal page
outlink: LINK to an external page
fieldsetvisibility:
type: fieldset
legend: Visibility