diff --git a/app/Http/Controllers/Theming/ThemeController.php b/app/Http/Controllers/Theming/ThemeController.php
index 9aea678..311be0f 100644
--- a/app/Http/Controllers/Theming/ThemeController.php
+++ b/app/Http/Controllers/Theming/ThemeController.php
@@ -96,29 +96,71 @@ class ThemeController extends Controller
public function getView($view = 'index')
{
- $template = 'fipamo-default-v2.index';
+ $template;
+ $pageData = [];
switch ($view) {
+ case "index":
case "page":
- $template = 'fipamo-default-v2.page';
+ $view == 'index' ?
+ $template = 'fipamo-default-v2.index' :
+ $template = 'fipamo-default-v2.page';
+ $page = $this->pages->getById('09E5A362-BA31-4AE2-9DEE-C93DFBE005C3')->first();
+ $data = $this->sort->page($page);
+ $pageData = [
+ "debug" => "true",
+ "theme" => 'fipamo-default-v2',
+ "status" => $this->auth::status(),
+ "title" => "THEME PAGE",
+ "meta" => $data['meta'],
+ "menu" => $data['menu'],
+ "info" => $data['info'],
+ "media" => $data['media'],
+ "files" => $data['files'],
+ "content" => $data['content'],
+ "recent" => $data['recent'],
+ "feature" => $data['featured'],
+ "tags" => $data['tags'],
+ "dynamicRender" => $data['dynamicRender'],
+ ];
+ break;
+ case "tags":
+ $template = 'fipamo-default-v2.tags';
+ $data = $this->sort->tags();
+ $pageData = [
+ 'debug' => true, // for theme kit
+ 'theme' => 'fipamo-default-v2', // for theme kit
+ 'title' => 'Pages Tagged as Tag',
+ 'dynamicRender' => $data['info']['dynamicRender'],
+ 'tags' => $data['info']['tags'][3]['pages'],
+ 'info' => $data['info'],
+ 'menu' => $data['info']['menu'],
+ 'media' => [
+ ['file' => $data['info']['image'],
+ 'type' => trim(pathinfo($data['info']['image'], PATHINFO_EXTENSION))]
+ ],
+ ];
+ break;
+ case "archives":
+ case "archive":
+ $template = 'fipamo-default-v2.archive';
+ $data = $this->sort->archive();
+ $pageData = [
+ 'debug' => true, // for theme kit
+ 'theme' => 'fipamo-default-v2', // for theme kit
+ 'title' => 'Archives',
+ 'dynamicRender' => $data['info']['dynamicRender'],
+ 'archive' => $data['archive'],
+ 'info' => $data['info'],
+ 'menu' => $data['info']['menu'],
+ 'media' => [
+ ['file' => $data['info']['image'],
+ 'type' => trim(pathinfo($data['info']['image'], PATHINFO_EXTENSION))]
+ ],
+ ];
break;
}
if ($this->auth::status()) {
- $page = $this->pages->getById('58E3D3DA-E7E4-4396-B4E5-0C30781C2F19')->first();
- $data = $this->sort->page($page);
- return view($template, [
- "debug" => "true",
- "theme" => 'fipamo-default-v2',
- "status" => $this->auth::status(),
- "title" => "THEME PAGE",
- "menu" => $data['menu'],
- "page" => $page,
- "info" => $data['info'],
- "media" => $data['media'],
- "content" => $data['content'],
- "recent" => $data['recent'],
- "feature" => $data['featured'],
- "dynamicRender" => $data['dynamicRender'],
- ]);
+ return view($template, $pageData);
} else {
return redirect('dashboard/start');
}
diff --git a/app/Services/SettingsService.php b/app/Services/SettingsService.php
index 4b97b33..d56bb5b 100644
--- a/app/Services/SettingsService.php
+++ b/app/Services/SettingsService.php
@@ -12,6 +12,7 @@ class SettingsService
public function __construct(DocService $docService)
{
$this->folks = json_decode(file_get_contents(env('FOLKS_PATH')), true);
+ $this->tags = json_decode(file_get_contents(env('TAGS_PATH')), true);
$this->docs = $docService;
}
@@ -37,6 +38,11 @@ class SettingsService
return $this->settings['menu'];
}
+ public function getTags()
+ {
+ return $this->tags;
+ }
+
public function getFolks()
{
return $this->folks;
diff --git a/app/Services/SortingService.php b/app/Services/SortingService.php
index 28d5aae..35973b0 100644
--- a/app/Services/SortingService.php
+++ b/app/Services/SortingService.php
@@ -42,7 +42,25 @@ class SortingService
}
}
}
- return $this->p_tags;
+ $global = $this->settings->getGlobal();
+ $tagData = [];
+
+ $pageInfo = [
+ 'keywords' => isset($global['keywords'])
+ ? $global['keywords']
+ : 'fipamo, blog, jamstack, php, markdown, js',
+ 'menu' => $this->settings->getMenu(),
+ 'tags' => $this->settings->getTags(),
+ 'description' => $global['descriptions'],
+ 'image' => $global['base_url'] . $global['background'],
+ 'baseURL' => $global['base_url'],
+ 'dynamicRender' => $global['dynamicRender'],
+ ];
+ $tagData = [
+ 'tags' => $this->p_tags,
+ 'info' => $pageInfo,
+ ];
+ return $tagData;
}
private function tagPages($tag, $pages)
@@ -114,7 +132,25 @@ class SortingService
'year_data' => $sorted,
]);
}
- return $this->p_archive;
+ $global = $this->settings->getGlobal();
+ $archive_data = [];
+ $pageInfo = [
+ 'keywords' => isset($global['keywords'])
+ ? $global['keywords']
+ : 'fipamo, blog, jamstack, php, markdown, js',
+ 'menu' => $this->settings->getMenu(),
+ 'tags' => $this->settings->getTags(),
+ 'description' => $global['descriptions'],
+ 'image' => $global['base_url'] . $global['background'],
+ 'baseURL' => $global['base_url'],
+ 'dynamicRender' => $global['dynamicRender'],
+ ];
+ $archiveData = [
+ 'archive' => $this->p_archive,
+ 'info' => $pageInfo,
+ ];
+
+ return $archiveData;
}
public function page($page)
@@ -164,65 +200,52 @@ class SortingService
}
}
//TODO: get rid of if statement and always return recent and featured
- if ($page['layout'] == 'index') {
- $recent = [];
- $featured = [];
- $limit = 4;
- $pages = $this->contents->loadAllPages();
- foreach ($pages as $item) {
- if (
- !$item['deleted'] &&
- $item['published'] &&
- $item['menu'] != 'true'
- ) {
- if (count($recent) < $limit) {
- array_push($recent, [
+ $recent = [];
+ $featured = [];
+ $limit = 4;
+ $pages = $this->contents->loadAllPages();
+ foreach ($pages as $item) {
+ if (
+ !$item['deleted'] &&
+ $item['published'] &&
+ $item['menu'] != 'true'
+ ) {
+ if (count($recent) < $limit) {
+ array_push($recent, [
+ 'path' => $item['path'],
+ 'slug' => $item['slug'],
+ 'title' => $item['title'],
+ 'feature' => $item['feature'],
+ ]);
+ }
+
+ if ($item['featured'] == true) {
+ if (count($featured) < $limit) {
+ array_push($featured, [
'path' => $item['path'],
'slug' => $item['slug'],
'title' => $item['title'],
'feature' => $item['feature'],
]);
}
-
- if ($item['featured'] == true) {
- if (count($featured) < $limit) {
- array_push($featured, [
- 'path' => $item['path'],
- 'slug' => $item['slug'],
- 'title' => $item['title'],
- 'feature' => $item['feature'],
- ]);
- }
- }
}
}
-
- $pageOptions = [
- 'title' => $page['title'],
- 'background' => $page['feature'],
- 'content' => $page['html'], // $cleaned,
- 'meta' => $meta,
- 'recent' => $recent,
- 'featured' => $featured,
- 'info' => $pageInfo,
- 'menu' => $this->settings->getMenu(),
- 'dynamicRender' => $global['dynamicRender'],
- 'media' => $page['media'],
- 'files' => $page['docs'],
- ];
- } else {
- $pageOptions = [
- 'title' => $page['title'],
- 'background' => $page['feature'],
- 'content' => $page['html'], // $cleaned,
- 'meta' => $meta,
- 'info' => $pageInfo,
- 'menu' => $this->settings->getMenu(),
- 'dynamicRender' => $global['dynamicRender'],
- 'media' => $page['media'],
- 'files' => $page['docs'],
- ];
}
+
+ $pageOptions = [
+ 'title' => $page['title'],
+ 'background' => $page['feature'],
+ 'content' => $page['html'],
+ 'meta' => $meta,
+ 'recent' => $recent,
+ 'featured' => $featured,
+ 'info' => $pageInfo,
+ 'menu' => $this->settings->getMenu(),
+ 'dynamicRender' => $global['dynamicRender'],
+ 'media' => $page['media'],
+ 'files' => $page['docs'],
+ 'tags' => $meta['tags'],
+ ];
return $pageOptions;
}
}
diff --git a/content/themes/fipamo-default-v2/archive.blade.php b/content/themes/fipamo-default-v2/archive.blade.php
new file mode 100644
index 0000000..3892a6f
--- /dev/null
+++ b/content/themes/fipamo-default-v2/archive.blade.php
@@ -0,0 +1,33 @@
+@extends('fipamo-default-v2.base')
+
+@section('title', $title)
+
+@section('main-content')
+
+ {{ $title }}
+
+
+ @foreach($archive as $item)
+
+
{{ $item['year'] }}
+ @foreach($item['year_data'] as $data)
+
+ @endforeach
+
+ @endforeach
+
+
+@endsection
diff --git a/content/themes/fipamo-default-v2/archive.twig b/content/themes/fipamo-default-v2/archive.twig
deleted file mode 100644
index 7b97a40..0000000
--- a/content/themes/fipamo-default-v2/archive.twig
+++ /dev/null
@@ -1,37 +0,0 @@
-{% extends "frame.twig" %}
-
-{% block title %}
- {{ title }}
-{% endblock %}
-
-{% block mainContent %}
-
- {{ title }}
-
-
- {% for item in archives %}
-
-
{{ item.year }}
- {% for data in item.year_data %}
-
-
{{ data.full_month }}
- {% for page in data.pages %}
- {% if dynamicRender is defined %}
- {% if dynamicRender == 'true' %}
-
{{ page.title }}
- {% else %}
-
{{ page.title }}
- {% endif %}
-
- {% else %}
-
{{ page.title }}
- {% endif %}
- {% endfor %}
-
-
- {% endfor %}
-
- {% endfor %}
-
-
-{% endblock %}
\ No newline at end of file
diff --git a/content/themes/fipamo-default-v2/base.blade.php b/content/themes/fipamo-default-v2/base.blade.php
index 86cf27e..c58b2ae 100644
--- a/content/themes/fipamo-default-v2/base.blade.php
+++ b/content/themes/fipamo-default-v2/base.blade.php
@@ -25,8 +25,8 @@