bee

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 4d8a81ce32e4ac95fc344325cb2469ce44fc4510
parent 268c9d8f8a4db4c98fa41de3c7cd497a0d2a14fd
Author: dankert <dankert@duese>
Date:   Mon, 12 Nov 2018 20:46:02 +0100

Beispiel-Sites 'default' und 'bee'.

Diffstat:
bee/SiteReader.class.php | 11++++++++---
site/bee/site-config.ini | 19+++++++++++++++++++
site/bee/start.md | 16++++++++++++++++
site/default/products/start.md | 13+++++++++++++
theme/default.php | 19+++++++++++++------
theme/default/default.css | 176++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------
theme/responsive.php | 180+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
theme/responsive/style.css | 114+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8 files changed, 493 insertions(+), 55 deletions(-)

diff --git a/bee/SiteReader.class.php b/bee/SiteReader.class.php @@ -42,7 +42,7 @@ class SiteReader if ( !isset($this->pagesByCategory[$category])) $this->pagesByCategory[$category] = array(); $this->pagesByCategory[$category][] = $page; - $this->categoryNames[$category] = $page['category']; + $this->categoryNames[$category] = $page['config']['category']; } } @@ -88,7 +88,7 @@ class SiteReader // Category if ( isset( $page['config']['category'] )) - $page['category'] = $page['config']['category']; + $page['category'] = $this->urlify($page['config']['category']); // keywords is similar to tags @@ -128,7 +128,12 @@ class SiteReader $page['title'] = $page['config']['title']; else $page['title'] = basename($page['filename']); - + + if (isset($page['config']['theme'])) + $page['theme'] = $page['config']['theme']; + else + $page['theme'] = THEME; // not supported - because bee.php doesnt know which theme should be searched for static resources. + if (isset($page['config']['author'])) // Username from page config. $page['author'] = $page['config']['author']; diff --git a/site/bee/site-config.ini b/site/bee/site-config.ini @@ -0,0 +1,19 @@ + +title = Bee Static Site generator +theme = default + +lang_related_pages=Ähnliche Seiten +lang_from=von +lang_to=bis +lang_in=in +lang_recent_pages=Letzte Aktualisierungen +lang_keywords=Schlüsselwörter +lang_categories=Kategorien +lang_calendar=Nach Datum + +footer_category='ueber' + +date_format_full=am %A, %e. %B %G um %H:%M Uhr +date_format=%e.%m.%G %H:%M + +locale = de_DE.UTF-8 diff --git a/site/bee/start.md b/site/bee/start.md @@ -0,0 +1,15 @@ +--- +Title: Ein neuer Static-Site-Generator +Date: 2017-10-03 20:40:07+02:00 +Keywords: Bee, static site generator, cms, php +Category: +Url: +Author: Jan +--- + +Ich stelle vor: Einen neuen Static-Site-Generator. + +Warum? Weil es ging :) + + +![](images/mtb.jpg)+ \ No newline at end of file diff --git a/site/default/products/start.md b/site/default/products/start.md @@ -0,0 +1,12 @@ +--- +title: Neue Blogengine +keywords: PHP, Blog, Static Site Generator +date: 2017-08-17 21:57:00 +category: Produkte und Waren +--- + +# Hello world. + +I am in the future. + +*Markdown is cool.*+ \ No newline at end of file diff --git a/theme/default.php b/theme/default.php @@ -28,21 +28,28 @@ extract($lang,EXTR_SKIP); <h1><?php echo $site_title ?></h1> </header> +<main> + <article> <header id="name"> - <h1><?php echo TITLE ?></h1> <?php if ( is_array($PAGE) ) { ?> - <span class="date"><?php echo strftime($site_date_format_full,$PAGE['date']) ?></span> + <span class="category"><a href="<?php echo SITE_UP.'category'.SLASH.$PAGE['category'] ?>"><?php echo $CATEGORY_NAMES[$PAGE['category']] ?></a></span><br/><br/> <span class="author"><?php echo $PAGE['author'] ?></span> - <span class="category"><a href="<?php echo SITE_UP.'category'.SLASH.$PAGE['category'] ?>"><?php echo $PAGE['category'] ?></a></span> - <ul class="keywords"><?php foreach( $PAGE['keywords'] as $keyword ) { ?><li><a href="<?php echo SITE_UP.'tag'.SLASH.$keyword ?>"><?php echo $keyword ?></a></li><?php } ?></ul> + <span class="date"><?php echo strftime($site_date_format_full,$PAGE['date']) ?></span><br/> <?php } ?> + + <h1><?php echo TITLE ?></h1> </header> <?php echo CONTENT ?> -</article> + + <?php if ( is_array($PAGE) ) { ?> + <ul class="keywords"><?php foreach( $PAGE['keywords'] as $keyword ) { ?><li><a href="<?php echo SITE_UP.'tag'.SLASH.$keyword ?>"><?php echo $keyword ?></a></li><?php } ?></ul> + <?php } ?> + + </article> <?php if ( is_array($PAGE) ) { ?> @@ -162,7 +169,7 @@ foreach( $PAGES_BY_CATEGORY as $category=>$pages) </nav> - +</main> <footer> diff --git a/theme/default/default.css b/theme/default/default.css @@ -1,66 +1,149 @@ html { - line-height: 1.15; /* 1 */ - -ms-text-size-adjust: 100%; /* 2 */ - -webkit-text-size-adjust: 100%; /* 2 */ + line-height: 1.15; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ } -article, -aside, -footer, -header, -nav, -section { - display: block; +a { + background-color: transparent; /* 1 */ + -webkit-text-decoration-skip: objects; /* 2 */ } -footer { - display:block; - background-color:silver; padding:20px; +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", + "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", + "Helvetica Neue", sans-serif; + font-size: 13px; + margin: 0px; + background-color: DimGray; + color: white; + width: 100%; + padding: 0; } -body > header -{ - width:100%; - background:silver; +html { + width: 100%; + box-sizing: border-box; } -nav#recent,nav#calendar,nav#keywords,nav#categories { - float:right; - width:33%; - clear:right; +*,::before,::after { + box-sizing: inherit; } -article,nav#related -{ - float:left; - width:66.9%; - clear:left; +article,aside,footer,header,nav,section { + display: block; } -h1 { - font-size: 2em; - margin: 0.67em 0; + +footer,body>header { + display: block; + background-color: silver; + padding: 2em; } -a { - background-color: transparent; /* 1 */ - -webkit-text-decoration-skip: objects; /* 2 */ +nav#recent,nav#calendar,nav#keywords,nav#categories,article,nav#related + { + display: block; + width: 100%; + padding: 2em; } +nav { + border-top: 1px solid gray; +} -body { - font-family: -apple-system, BlinkMacSystemFont, - "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", - "Fira Sans", "Droid Sans", "Helvetica Neue", - sans-serif; - font-size:13px; margin:0px; +h1 { + font-size: 2em; + margin: 0.67em 0; + padding-bottom: 0.5em; +} + +nav ul, footer ul { + list-style: none; + padding-left:0px; + line-height: 1.4em; +} +ul ul { + padding-left:10px; +} + + main article { + font-size: 1.2em; + } - background-color: DimGray; - color:white; - width: 100%; - xmax-width:95em; - padding:0; - margin:0; + main article header .date { + font-size:1rem; + } + main article header .author { + font-size:1rem; + font-style: italic; + } + main article header .category { + font-size:1rem; + font-weight: bold; + display:inline; + padding:0.2em 1em; + margin-bottom:0.8em; + border: 1px solid gray; + border-radius: 0.5em; + background-color: gray; } + main article ul.keywords { + font-size:0.8rem; + list-style: none; + padding:0; + margin:4em 0; + } + main article ul.keywords li { + display:inline; + padding:0.2em 1em; + margin-right: 0.8em; + border: 1px solid silver; + border-radius: 0.5em; + background-color: silver; + + } + img { + width:100%; + height:auto; + } + +/* Desktop */ +@media all and (min-width: 50em) { + main { + display: flex; + flex-flow: row wrap; + } + main article { + flex:2 1 100%; + order:1; + } + main nav#recent,main nav#calendar,main nav#keywords,main nav#categories,main nav#related { + flex: 1 1 25%; + width:25%; + } + main nav#recent { + order:4; + } +main nav#related { + order:2; + } + main nav#calendar { + order:5; + } + main nav#keywords { + order:6; + } + main nav#categories { + order:3; + } -html { width:100%; box-sizing: border-box; } -*, ::before, ::after { box-sizing: inherit; } + header,main,footer { + margin: 0 auto; + } + + main article { + max-width:70em; + padding:3em 10em; + margin: 0 auto; + } +}+ \ No newline at end of file diff --git a/theme/responsive.php b/theme/responsive.php @@ -0,0 +1,180 @@ +<?php +$lang = array( + 'site_lang_recent_pages' =>'Recent Pages', + 'site_lang_related_pages'=>'Related Pages', + 'site_lang_keywords' =>'Keywords', + 'site_lang_categories' =>'Categories', + 'site_lang_calendar' =>'Calendar', + 'site_lang_from' =>'from', + 'site_lang_to' =>'to', + 'site_lang_in' =>'in', + 'site_date_format' =>'%x', + 'site_date_format_full' =>'%x', + 'site_footer_category' =>'about', + 'site_title' =>'My Blog' +); +extract($lang,EXTR_SKIP); + +?><html lang="de"> +<head> + <title><?php echo TITLE ?> - <?php echo $site_title ?></title> + <meta content="text/html; charset=UTF-8" http-equiv="content-type" /> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + <link rel="stylesheet" href="<?php echo SITE_UP ?>style.css"> +</head> +<body> + +<header> + <h1><?php echo $site_title ?></h1> +</header> + +<main> + +<article> + + <header id="name"> + <h1><?php echo TITLE ?></h1> + + <?php if ( is_array($PAGE) ) { ?> + <span class="date"><?php echo strftime($site_date_format_full,$PAGE['date']) ?></span> + <span class="author"><?php echo $PAGE['author'] ?></span> + <span class="category"><a href="<?php echo SITE_UP.'category'.SLASH.$PAGE['category'] ?>"><?php echo $PAGE['category'] ?></a></span> + <ul class="keywords"><?php foreach( $PAGE['keywords'] as $keyword ) { ?><li><a href="<?php echo SITE_UP.'tag'.SLASH.$keyword ?>"><?php echo $keyword ?></a></li><?php } ?></ul> + <?php } ?> + </header> + + <?php echo CONTENT ?> +</article> + + +<?php if ( is_array($PAGE) ) { ?> +<nav id="related"> +<header> +<h1><?php echo $site_lang_related_pages ?></h1> +</header> +<ul> +<?php foreach( $PAGES_RELATED as $page ) + {?> + <li> + <a href="<?php echo SITE_UP.$page['url'] ?>"><?php echo $page['title'] ?></a> + </li> + <?php } ?> +</ul> + +</nav> +<?php } ?> + + +<nav id="categories"> +<header> +<h1><?php echo $site_lang_categories ?></h1> +</header> + +<ul> +<?php $count=0; +foreach( $PAGES_BY_CATEGORY as $category=>$pages) + { ?> + <li><a href="<?php echo SITE_UP.'category/'.$category ?>"><?php echo $CATEGORY_NAMES[$category] ?></a></li> + <?php } ?> +</ul> +</nav> + + + + + +<nav id="recent"> +<header> +<h1><?php echo $site_lang_recent_pages ?></h1> +</header> +<ul> +<?php $count=0; foreach( array_reverse($PAGES_BY_DATE) as $pagesOnDate) + { + foreach( $pagesOnDate as $page ) + { + + if ($count++ > 10) break; ?> + <li> + <a href="<?php echo SITE_UP.$page['url'] ?>"><?php echo $page['title'] ?></a> + </li> + <?php }} ?> +</ul> + +</nav> + + +<nav id="calendar"> + <header> + <h1><?php echo $site_lang_calendar ?></h1> + </header> + +<ul class="year"> +<?php $oldYear = 0; foreach( array_reverse($PAGES_BY_DATE,true) as $date => $pagesOnDate) + { + $year = date('Y',$date); + if ( $year != $oldYear ) + { + $oldYear = $year; + ?> + <li> + <a href="<?php echo SITE_UP.$year ?>"><?php echo $year ?></a> + <ul class="month"> + <?php + $oldMonth = 0; + foreach( array_reverse($PAGES_BY_DATE,true) as $date2 => $pagesOnDate) + { + $y = date('Y',$date2); + if ( $y != $year) + continue; + + $month = date('m',$date2); + if ( $month != $oldMonth ) + { + $oldMonth = $month; + + ?> + <li> + <a href="<?php echo SITE_UP.$year.SLASH.$month ?>"><?php echo date('F',$date2) ?></a> + </li> + <?php }} ?> + </ul> + </li> + + <?php } } ?> +</ul> + +</nav> + + +<nav id="keywords"> +<header> +<h1><?php echo $site_lang_keywords ?></h1> +</header> + +<ul> +<?php $count=0; foreach( $PAGES_BY_KEYWORD as $keyword=>$pages) + { + $fontsize = min(3,((count($pages)-1)/5)+1); ?> + + <li style="font-size:<?php echo $fontsize ?>em;"><a href="<?php echo SITE_UP.'tag/'.$keyword ?>"><?php echo $keyword ?></a> + </li> + <?php } ?> +</ul> + +</nav> + + +</main> + +<footer> + +<ul> +<?php foreach( $PAGES_BY_CATEGORY[$site_footer_category] as $page) {?> +<li><a href="<?php echo SITE_UP.$page['url'] ?>"><?php echo $page['title']?></a></li> +<?php } ?> +</ul> + +</footer> + +</body> +</html> diff --git a/theme/responsive/style.css b/theme/responsive/style.css @@ -0,0 +1,113 @@ +html { + line-height: 1.15; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +a { + background-color: transparent; /* 1 */ + -webkit-text-decoration-skip: objects; /* 2 */ +} + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", + "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", + "Helvetica Neue", sans-serif; + font-size: 13px; + margin: 0px; + xbackground-color: DimGray; + color: #0B0B0B; + width: 100%; + padding: 0; +} + +html { + width: 100%; + box-sizing: border-box; +} + +*,::before,::after { + box-sizing: inherit; +} + +article,aside,footer,header,nav,section { + display: block; +} + +footer,body>header { + display: block; + background-color: silver; + padding: 2em; +} + +nav#recent,nav#calendar,nav#keywords,nav#categories,article,nav#related + { + display: block; + width: 100%; + padding: 2em; +} + +nav { + border-top: 1px solid gray; +} + +h1 { + font-size: 2em; + margin: 0.67em 0; + padding-bottom: 0.5em; +} + +nav ul, footer ul { + list-style: none; + padding-left:0px; + line-height: 1.4em; +} +ul ul { + padding-left:10px; +} + + main article { + font-size: 1.2em; + } + + +/* Desktop */ +@media all and (min-width: 50em) { + main { + display: flex; + flex-flow: row wrap; + } + main article { + flex:2 1 100%; + order:1; + } + main nav#recent,main nav#calendar,main nav#keywords,main nav#categories,main nav#related { + flex: 1 1 25%; + width:25%; + } + main nav#recent { + order:4; + } +main nav#related { + order:2; + } + main nav#calendar { + order:5; + } + main nav#keywords { + order:6; + } + main nav#categories { + order:3; + } + + header,main,footer { + margin: 0 auto; + } + + main article { + max-width:70em; + padding:0 10em; + margin: 0 auto; + } +}+ \ No newline at end of file