diff --git a/content/.yaml b/content/.yaml new file mode 100644 index 0000000..1b60d31 --- /dev/null +++ b/content/.yaml @@ -0,0 +1,8 @@ +meta: + title: 'Hidden Folder' + description: Content + author: 'Sebastian Schürmanns' + created: '2020-05-02' + time: 12-41-06 + navtitle: null + modified: '2020-05-02' diff --git a/media/live/altdruck.png b/media/live/altdruck.png deleted file mode 100644 index 3abbad9..0000000 Binary files a/media/live/altdruck.png and /dev/null differ diff --git a/media/live/ivan-bandura-cnsuw8uth-e-unsplash.jpeg b/media/live/ivan-bandura-cnsuw8uth-e-unsplash.jpeg deleted file mode 100644 index 43b427f..0000000 Binary files a/media/live/ivan-bandura-cnsuw8uth-e-unsplash.jpeg and /dev/null differ diff --git a/media/live/knowledge.jpeg b/media/live/knowledge.jpeg deleted file mode 100644 index 35d7423..0000000 Binary files a/media/live/knowledge.jpeg and /dev/null differ diff --git a/media/original/altdruck.png b/media/original/altdruck.png deleted file mode 100644 index 9ab0d0f..0000000 Binary files a/media/original/altdruck.png and /dev/null differ diff --git a/media/original/ivan-bandura-cnsuw8uth-e-unsplash.jpeg b/media/original/ivan-bandura-cnsuw8uth-e-unsplash.jpeg deleted file mode 100644 index 27c24c0..0000000 Binary files a/media/original/ivan-bandura-cnsuw8uth-e-unsplash.jpeg and /dev/null differ diff --git a/media/original/knowledge.jpeg b/media/original/knowledge.jpeg deleted file mode 100644 index 8a8fea5..0000000 Binary files a/media/original/knowledge.jpeg and /dev/null differ diff --git a/media/thumbs/altdruck.png b/media/thumbs/altdruck.png deleted file mode 100644 index 472049d..0000000 Binary files a/media/thumbs/altdruck.png and /dev/null differ diff --git a/media/thumbs/ivan-bandura-cnsuw8uth-e-unsplash.jpeg b/media/thumbs/ivan-bandura-cnsuw8uth-e-unsplash.jpeg deleted file mode 100644 index aca149b..0000000 Binary files a/media/thumbs/ivan-bandura-cnsuw8uth-e-unsplash.jpeg and /dev/null differ diff --git a/media/thumbs/knowledge.jpeg b/media/thumbs/knowledge.jpeg deleted file mode 100644 index 29dd32d..0000000 Binary files a/media/thumbs/knowledge.jpeg and /dev/null differ diff --git a/system/Controllers/MetaApiController.php b/system/Controllers/MetaApiController.php index b05dffc..8e48e41 100644 --- a/system/Controllers/MetaApiController.php +++ b/system/Controllers/MetaApiController.php @@ -37,14 +37,17 @@ class MetaApiController extends ContentController } # loop through all plugins - foreach($this->settings['plugins'] as $name => $plugin) + if(!empty($this->settings['plugins'])) { - if($plugin['active']) + foreach($this->settings['plugins'] as $name => $plugin) { - $pluginSettings = \Typemill\Settings::getObjectSettings('plugins', $name); - if($pluginSettings && isset($pluginSettings['metatabs'])) + if($plugin['active']) { - $metatabs = array_merge_recursive($metatabs, $pluginSettings['metatabs']); + $pluginSettings = \Typemill\Settings::getObjectSettings('plugins', $name); + if($pluginSettings && isset($pluginSettings['metatabs'])) + { + $metatabs = array_merge_recursive($metatabs, $pluginSettings['metatabs']); + } } } } diff --git a/system/Controllers/PageController.php b/system/Controllers/PageController.php index b9ce0ed..26e23b9 100644 --- a/system/Controllers/PageController.php +++ b/system/Controllers/PageController.php @@ -9,7 +9,6 @@ use Typemill\Models\WriteYaml; use Typemill\Models\WriteMeta; use \Symfony\Component\Yaml\Yaml; use Typemill\Models\VersionCheck; -use Typemill\Models\Helpers; use Typemill\Models\Markdown; use Typemill\Events\OnPagetreeLoaded; use Typemill\Events\OnBreadcrumbLoaded; @@ -39,17 +38,17 @@ class PageController extends Controller try { - /* if the cached structure is still valid, use it */ + # if the cached structure is still valid, use it if($cache->validate('cache', 'lastCache.txt', 600)) { $structure = $this->getCachedStructure($cache); } if(!isset($structure) OR !$structure) { - /* if not, get a fresh structure of the content folder */ + # if not, get a fresh structure of the content folder $structure = $this->getFreshStructure($pathToContent, $cache, $uri); - /* if there is no structure at all, the content folder is probably empty */ + # if there is no structure at all, the content folder is probably empty if(!$structure) { $content = '

No Content

Your content folder is empty.

'; @@ -58,13 +57,13 @@ class PageController extends Controller } elseif(!$cache->validate('cache', 'lastSitemap.txt', 86400)) { - /* update sitemap */ + # update sitemap $sitemap = new WriteSitemap(); $sitemap->updateSitemap('cache', 'sitemap.xml', 'lastSitemap.txt', $structure, $uri->getBaseUrl()); } } - /* dispatch event and let others manipulate the structure */ + # dispatch event and let others manipulate the structure $structure = $this->c->dispatcher->dispatch('onPagetreeLoaded', new OnPagetreeLoaded($structure))->getData(); } catch (Exception $e) @@ -86,31 +85,45 @@ class PageController extends Controller { $home = true; $item = Folder::getItemForUrl($navigation, $uri->getBasePath(), $uri->getBasePath()); - $urlRel = $uri->getBasePath(); + $urlRel = $uri->getBasePath(); } else { - /* get the request url */ + # get the request url $urlRel = $uri->getBasePath() . '/' . $args['params']; - /* find the url in the content-item-tree and return the item-object for the file */ + # find the url in the content-item-tree and return the item-object for the file + # important to use the structure here so it is found, even if the item is hidden. $item = Folder::getItemForUrl($structure, $urlRel, $uri->getBasePath()); - /* if there is still no item, return a 404-page */ + # if there is still no item, return a 404-page if(!$item) { return $this->render404($response, array( 'navigation' => $navigation, 'settings' => $settings, 'base_url' => $base_url )); } - /* get breadcrumb for page */ - $breadcrumb = Folder::getBreadcrumb($structure, $item->keyPathArray); - $breadcrumb = $this->c->dispatcher->dispatch('onBreadcrumbLoaded', new OnBreadcrumbLoaded($breadcrumb))->getData(); + if(!$item->hide) + { + # get breadcrumb for page and set pages active + # use navigation, the hidden pages won't get a breadcrumb + $breadcrumb = Folder::getBreadcrumb($navigation, $item->keyPathArray); + $breadcrumb = $this->c->dispatcher->dispatch('onBreadcrumbLoaded', new OnBreadcrumbLoaded($breadcrumb))->getData(); - # set pages active for navigation again - Folder::getBreadcrumb($structure, $item->keyPathArray); - - /* add the paging to the item */ - $item = Folder::getPagingForItem($navigation, $item); + # set pages active for navigation again + # Folder::getBreadcrumb($navigation, $item->keyPathArray); + + # add the paging to the item + $item = Folder::getPagingForItem($navigation, $item); + } + } + + if(isset($item->hide) && $item->hide) + { + # delete the paging elements + $item->thisChapter = false; + $item->nextItem = false; + $item->prevItem = false; + $breadcrumb = false; } # dispatch the item @@ -124,8 +137,12 @@ class PageController extends Controller { $filePath = $filePath . DIRECTORY_SEPARATOR . 'index.md'; - # use navigation instead of structure to get - $item = Folder::getItemForUrl($navigation, $urlRel, $uri->getBasePath()); + # if folder is not hidden + if(isset($item->hide) && !$item->hide) + { + # use the navigation instead of the structure so that hidden elements are erased + $item = Folder::getItemForUrl($navigation, $urlRel, $uri->getBasePath()); + } } # read the content of the file diff --git a/system/Settings.php b/system/Settings.php index 5c20c18..b83d52e 100644 --- a/system/Settings.php +++ b/system/Settings.php @@ -39,7 +39,7 @@ class Settings } # let us load translations only for admin area to improve performance for frontend - $uri = $_SERVER[REQUEST_URI]; + $uri = $_SERVER['REQUEST_URI']; if(isset($uri) && (strpos($uri,'/tm/') !== false OR strpos($uri,'/setup') !== false)) { # i18n diff --git a/themes/typemill/css/style.css b/themes/typemill/css/style.css index 886cbea..63a2fa0 100644 --- a/themes/typemill/css/style.css +++ b/themes/typemill/css/style.css @@ -116,13 +116,15 @@ header{ } aside{ display: block; - position: absolute; - top: 175px; padding: 0; margin: 0; left: 20px; right: 20px; } +aside#tmnavigation{ + position: absolute; + top: 175px; +} article{ width: 100%; position: relative; @@ -402,7 +404,22 @@ article .gitlink{ left: 10%; width: 80%; } - +/* +.p-image{ + display: table; + margin:auto; + max-width: 100%; +} +.p-image + .left{ + float:left; +} +.p-image img{ + display: block; +} +.p-image em{ + display: table-caption; + caption-side: bottom; +} /************************ * PAGING / BREADCRUMB * ************************/ @@ -881,7 +898,7 @@ img.myClass{ header{ text-align: left; } - aside{ + aside, aside#tmnavigation{ position: relative; top: 0; left: 0; diff --git a/themes/typemill/js/script.js b/themes/typemill/js/script.js index 608623d..69a62f2 100644 --- a/themes/typemill/js/script.js +++ b/themes/typemill/js/script.js @@ -1,5 +1,5 @@ -var menu = document.getElementById("menu"), - navi = document.getElementById("navigation"); +var menu = document.getElementById("tmmenu"), + navi = document.getElementById("tmnavigation"); if(menu) { diff --git a/themes/typemill/partials/breadcrumb.twig b/themes/typemill/partials/breadcrumb.twig index c07688c..31a7eb6 100644 --- a/themes/typemill/partials/breadcrumb.twig +++ b/themes/typemill/partials/breadcrumb.twig @@ -1,4 +1,4 @@ - {% if item.prevItem or item.nextItem %} + - {% endif %} diff --git a/themes/typemill/partials/layout.twig b/themes/typemill/partials/layout.twig index 3de9bc7..0eb0bdd 100644 --- a/themes/typemill/partials/layout.twig +++ b/themes/typemill/partials/layout.twig @@ -62,7 +62,7 @@ {% endfor %} {% endif %} -