|
|
@ -30,8 +30,11 @@ class Page {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
constructor(file, parent, fileString, blocks = {}) {
|
|
|
|
constructor(file, parent, fileString, blocks = {}) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// getting dirPath for files for page
|
|
|
|
|
|
|
|
this._dirPath = this._resolvePath(parent)
|
|
|
|
|
|
|
|
|
|
|
|
// parse file
|
|
|
|
// parse file
|
|
|
|
const result = parseMarkdownFile(fileString)
|
|
|
|
const result = parseMarkdownFile(fileString, this._dirPath)
|
|
|
|
|
|
|
|
|
|
|
|
// fields merge by default values
|
|
|
|
// fields merge by default values
|
|
|
|
this._fields = merge({
|
|
|
|
this._fields = merge({
|
|
|
@ -46,7 +49,6 @@ class Page {
|
|
|
|
// adding filename for html as pathname and relative path in structure
|
|
|
|
// adding filename for html as pathname and relative path in structure
|
|
|
|
this._filename = this._resolveFilename(file)
|
|
|
|
this._filename = this._resolveFilename(file)
|
|
|
|
this._slug = this._resolveSlug(this._filename)
|
|
|
|
this._slug = this._resolveSlug(this._filename)
|
|
|
|
this._dirPath = this._resolvePath(parent)
|
|
|
|
|
|
|
|
this._permalink = this._dirPath
|
|
|
|
this._permalink = this._dirPath
|
|
|
|
|
|
|
|
|
|
|
|
if (this._slug) {
|
|
|
|
if (this._slug) {
|
|
|
@ -121,8 +123,12 @@ class Page {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (typeof field === 'object' || field instanceof Object) {
|
|
|
|
if (typeof field === 'object' || field instanceof Object) {
|
|
|
|
|
|
|
|
if (field.options) {
|
|
|
|
|
|
|
|
field = media.resolve(field.src, field.sizes, field.options)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
field = media.resolve(field.src, field.sizes)
|
|
|
|
field = media.resolve(field.src, field.sizes)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return field
|
|
|
|
return field
|
|
|
|
}
|
|
|
|
}
|
|
|
|