• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

scriptype / writ-cms / 20147813003

11 Dec 2025 09:21PM UTC coverage: 32.574% (+0.3%) from 32.31%
20147813003

push

github

scriptype
Fix entryAlias not working in uncategorized post

In ContentModelEntryNode, use getIndexFile template method to set
this.indexFile (and not this.subtree.indexFile). Once the indexFile is
set and its content and frontmatter is parsed, continue calling other
template methods, importantly, getSubtreeMatchers.

After switching to use matcha expressions in matchers, they got out of
their function wrappers. So, if they wanted to refer to this properties
coming from front-matter, getSubtreeMatchers must have been called in
super after indexFile is parsed. This change does just that.

Setting this.indexFile instead of this.subtree.indexFile is for the
coherence. If indexFile remained under 'subtree', then it would be
confusing why its matcher is not in the getSubtreeMatchers. It feels
right to have it directly in 'this'.

Also add a missing edge-case to e2e-magazine: Uncategorized foldered
post with an aliased indexFile. Lack of this test so far was what
allowed this bug to hide so far.

434 of 3437 branches covered (12.63%)

Branch coverage included in aggregate %.

13 of 16 new or added lines in 6 files covered. (81.25%)

1383 of 2141 relevant lines covered (64.6%)

1154.88 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

81.48
/src/lib/ContentModelEntryNode.js
1
const { join } = require('path')
9✔
2
const makeSlug = require('slug')
9✔
3
const { makePermalink } = require('./contentModelHelpers')
9✔
4
const { parseTextEntry } = require('./parseTextEntry')
9✔
5
const ContentModelNode = require('./ContentModelNode')
9✔
6

7
class ContentModelEntryNode extends ContentModelNode {
8
  constructor(fsNode, context, settings = {}) {
×
9
    super(fsNode, context, settings)
1,953✔
10

11
    this.indexFile = this.getIndexFile()
1,953✔
12

13
    const isFlatData = !fsNode.stats?.birthtime
1,953✔
14
    const entryProperties = parseTextEntry(
1,953✔
15
      this.fsNode,
16
      this.indexFile || this.fsNode,
1,953!
17
      isFlatData
18
    )
19

20
    Object.assign(this, entryProperties)
1,953✔
21

22
    this.slug = this.getSlug()
1,953✔
23
    this.permalink = this.getPermalink()
1,953✔
24
    this.outputPath = this.getOutputPath()
1,953✔
25
    this.matchers = this.getSubtreeMatchers()
1,953✔
26
    this.subtree = {}
1,953✔
27
  }
28

29
  getIndexFile() {
NEW
30
    return this.fsNode
×
31
  }
32

33
  getSlug() {
34
    return this.slug
1,773✔
35
  }
36

37
  getPermalink() {
38
    return makePermalink(
1,098✔
39
      this.context.peek().permalink,
40
      this.slug
41
    ) + (this.hasIndex ? '' : '.html')
1,098✔
42
  }
43

44
  getOutputPath() {
45
    return join(
1,710✔
46
      this.context.peek().outputPath,
47
      this.slug
48
    )
49
  }
50

51
  getSubtreeMatchers() {
52
    return {}
×
53
  }
54

55
  parseSubtree() {
56
    return {}
×
57
  }
58

59
  afterEffects(contentModel) {}
60

61
  render(renderer) {}
62
}
63

64
module.exports = ContentModelEntryNode
9✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc