adding partial for meta

main
HerrHase 2 years ago
parent b747945d1a
commit 9405dbd593

@ -9,6 +9,9 @@
</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="{{ asset('/public/css/styles.css') }}" rel="stylesheet" type="text/css">
{{! await includeFile('./partials/meta.eta', { meta: it.page.data.meta }) }}
</head>
<body class="site-body {{ it.templateClass(it.page) }}">
<header class="site-header">
@ -17,11 +20,11 @@
<div class="bar__start">
{{# if (isHome(it.page)) { }}
<h1 class="site-header__title">
{{ it.page.data.title }}
{{ it.settings.data.project_name }}
</h1>
{{# } else { }}
<a class="site-header__title">
{{ it.page.data.title }}
{{ it.settings.data.project_name }}
</a>
{{# } }}
</div>
@ -34,8 +37,12 @@
</main>
<footer class="site-footer">
<div class="site-footer__copyright">
<div class="container">
<div class="grid">
<div class="col-12">
MIT License
</div>
</div>
</div>
</footer>

@ -0,0 +1,5 @@
{{# if (meta && typeof meta[Symbol.iterator] === 'function') { }}
{{# Object.keys(meta).forEach(function(key) { }}
<meta name="{{ meta[key].name }}" content="{{ meta[key].content }}" />
{{# }) }}
{{# } }}

@ -3,9 +3,14 @@
<div class="container">
<div class="grid">
<div class="col-12">
<div class="content">
{{! it.marked.parse(it.page.data.content) }}
</div>
<article>
<h1 class="page__title">
{{ it.page.data.title }}
</h1>
<div class="content page__title">
{{! it.marked.parse(it.page.data.content) }}
</div>
</article>
</div>
</div>
</div>

@ -28,26 +28,6 @@ function asset($path, $prefix = '/public')
return $path;
}
/**
* getting name of view as slug
*
* @param array $page
* @return string
*
*/
function canonical()
{
if (isset($_SERVER['HTTPS'])) {
$canoncial = 'https';
} else {
$canoncial = 'http';
}
$canoncial .= '://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
return $canoncial;
}
/**
* getting title for head
*

@ -15,6 +15,26 @@ const basePath = path.join(path.resolve(), '/../../')
*/
/**
* getting name of view as slug
*
* @param array $page
* @return string
*
*/
/**function canonical()
{
if (isset($_SERVER['HTTPS'])) {
$canoncial = 'https';
} else {
$canoncial = 'http';
}
$canoncial .= '://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
return $canoncial;
}*/
/**
* asset - checks manifest.json for given path and return
* file path with id for cache busting
@ -47,7 +67,7 @@ function asset(publicPath)
/**
* templateClass - parse template name to css-classname,
* use prefix, default is "page"
*
*
*
* @param {Object} entity
* @param {String} [prefix='page']

@ -17,10 +17,10 @@ export default async function(fastify, opts) {
/**
* prehandler for all routes
*
* @param {[type]} request
* @param {[type]} reponse
* @param {Object} request
* @param {Object} reponse
* @param {Function} done
* @return {[type]}
*
*/
fastify.addHook('preHandler', async function(request, response) {
@ -35,8 +35,8 @@ export default async function(fastify, opts) {
/**
* handle single post
*
* @param {object} request
* @param {object} response
* @param {Object} request
* @param {Object} response
*
*/
fastify.get('/:slug([-a-zA-Z0-9]{0,255})', async function(request, response) {

@ -2,6 +2,7 @@ import fastifyStatic from '@fastify/static'
import path from 'path'
/**
*
* static files that are send frontend package
*
* @author Björn Hase <me@herr-hase.wtf>

@ -15,24 +15,6 @@ import directusResponseHandler from './../handlers/directusResponse.js'
export default async function(fastify, opts) {
/**
* prehandler for all routes
*
* @param {[type]} request
* @param {[type]} reponse
* @param {Function} done
* @return {[type]}
*/
fastify.addHook('preHandler', async function(request, response) {
const pageStore = new PageStore()
// getting single page
let page = await pageStore.find(request.url)
directusResponseHandler.getOne(page, response)
})
/**
* handle single page
*
@ -50,7 +32,6 @@ export default async function(fastify, opts) {
pages.each((page, index) => {
})
})
}

@ -0,0 +1,4 @@
{
"/spritemap.js": "/spritemap.js?id=2dda73ecee3bb668b395026efda6524c",
"/css/styles.css": "/css/styles.css?id=c80a1181f87f3c3ef715844b545559f4"
}

@ -0,0 +1,13 @@
(self["webpackChunkfrontend"] = self["webpackChunkfrontend"] || []).push([["spritemap"],{
/***/ "?c20d":
/*!******************************!*\
!*** spritemap-dummy-module ***!
\******************************/
/***/ (() => {
/***/ })
}]);
Loading…
Cancel
Save