develop
HerrHase 1 year ago
parent 8dd02ce757
commit 0283d3d4c0

@ -1,6 +1,6 @@
---
title: "health goth DIY tattooed"
view: "home.njk"
view: "page.njk"
meta:
description: "La"
media:

@ -1,6 +1,8 @@
---
title: "health goth DIY tattooed"
view: "post.njk"
date_published: "09.10.2022"
excerpt: "jjj"
meta:
description: "DSA yes plz hot chicken green juice"
---

@ -1,6 +1,8 @@
---
title: "health goth DIY tattooed"
view: "post.njk"
date_published: "10.10.2022"
excerpt: "ddd"
meta:
description: "DSA yes plz hot chicken green juice"
---

@ -0,0 +1,5 @@
---
title: "rss"
view: "rss.njk"
type: "xml"
---

@ -2,7 +2,7 @@
{% block main %}
{% set posts = pageQuery.find({ orderBy: [ '-date_published' ], limit: 1, filter: { view: { _eq: 'post.njk' } } }) %}
{% set posts = pageQuery.find({ orderBy: [ '-date_published' ], limit: 2, filter: { view: { _eq: 'post.njk' } } }) %}
{% for post in posts %}
<a class="post" href="{{ post.path }}">

@ -1,5 +0,0 @@
{% extends('layout.njk') %}
{% block main %}
{% endblock %}

@ -0,0 +1,54 @@
{% set posts = pageQuery.find({ orderBy: [ '-date_published' ], limit: 10, filter: { view: { _eq: 'post.njk' } } }) %}
{% set http = 'http' %}
{% if (site.https) %}
{% set http = 'https' %}
{% endif %}
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
>
<channel>
<title>{{ site.title }}</title>
<atom:link href="{{ http }}://{{ site.domain }}{{ page.path }}" rel="self" type="application/rss+xml" />
<link>{{ http }}://{{ site.domain }}</link>
{% if site.description %}
<description>{{ site.description }}</description>
{% endif %}
<lastBuildDate>{{ dayjs() }}</lastBuildDate>
<language>{{ site.language }}-{{ site.language | upper }}</language>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<generator>https://gitea.node001.net/HerrHase/siteomat-webpack-plugin</generator>
{% for post in posts %}
<item>
<title>{{ post.title }}</title>
<link>{{ http }}://{{ site.domain }}{{ post.path }}</link>
<pubDate>{{ dayjs(post.date_published) }}</pubDate>
{% if post.excerpt %}
<description>
{{ post.excerpt }}
</description>
{% endif %}
<content:encoded>
<![CDATA[
{{ post.content | safe }}
]]>
</content:encoded>
<guid>{{ http }}://{{ site.domain }}{{ post.path }}</guid>
</item>
{% endfor %}
</channel>
</rss>

@ -1,6 +1,11 @@
const Siteomat = require('./src/siteomat.js')
const fs = require('fs')
/**
*
*
*
*/
class SiteomatWebpackPlugin {
constructor(source, views, options = {}) {

@ -1,6 +1,6 @@
{
"name": "@helpers/siteomat-webpack-plugin",
"version": "0.2.0",
"version": "0.3.0",
"build": "webpack",
"author": "Björn Hase <me@herr-hase.wtf>",
"main": "index.js",

@ -6,6 +6,7 @@ const { minify } = require('html-minifier')
const configStore = require('./../config.js')
const { asset, resize } = require('./helpers.js')
const PageQuery = require('./../queries/pages.js')
const dayjs = require('dayjs')
/**
* nunjucks
@ -48,6 +49,7 @@ class Engine {
this._defaults = {
site: site,
asset: asset,
dayjs: dayjs,
pageQuery: new PageQuery(configStore.get('source'))
}
}

@ -32,18 +32,19 @@ class Page {
// parse file
const result = parseMarkdownFile(fileString)
// adding filename for html as pathname and relative path in structure
this._filename = this._resolveFilename(file)
this._pathname = this._resolvePathname(parent)
// fields merge by default values
this._fields = merge({
view: 'page.njk',
type: 'html',
meta: {
robots: 'index'
}
}, result.fields)
// adding filename for html as pathname and relative path in structure
this._filename = this._resolveFilename(file)
this._pathname = this._resolvePathname(parent)
this._content = result.content
this._blocks = blocks
}
@ -62,7 +63,6 @@ class Page {
'path' : this._pathname + '/' + this._filename,
'filename' : this._filename,
'pathname' : this._pathname
}, this._fields)
}
@ -87,7 +87,7 @@ class Page {
filename = slugify(filename)
}
return filename + '.html'
return filename + '.' + this._fields.type
}
/**

@ -78,6 +78,56 @@ class Pages {
if (value['_eq'] && result[key] !== value['_eq']) {
isValid = false
}
if (value['_neq'] && result[key] === value['_eq']) {
isValid = false
}
/**
if (value['_in'] && value['_in'].indexOf(result[key]) !== -1) {
isValid = false
}
if (value['_nin'] && value['_nin'].indexOf(result[key]) === -1) {
isValid = false
}
if (value['_lt'] && result[key] < value['_lt']) {
isValid = false
}
if (value['_lte'] && result[key] <= value['_lte']) {
isValid = false
}
if (value['_gt'] && result[key] > value['_gt']) {
isValid = false
}
if (value['_gte'] && result[key] >= value['_gt']) {
isValid = false
}
if (value['_null'] && result[key]) {
isValid = false
}
if (value['_nnull'] && !result[key]) {
isValid = false
}
if (value['_contains'] && !result[key]) {
isValid = false
}
if (value['_ncontains'] && !result[key]) {
isValid = false
}
if (value['_regex'] && result[key].test(value['_regex'])) {
isValid = false
}*/
}
return isValid
@ -221,4 +271,4 @@ class Pages {
}
module.exports =Pages
module.exports = Pages
Loading…
Cancel
Save