Skip to content

Commit

Permalink
Updated tree view to use frontmatter title
Browse files Browse the repository at this point in the history
Simply had to copy a function and tweak it slightly.
Closes #8.
  • Loading branch information
thomaskoppelaar committed Apr 29, 2020
1 parent c248ec7 commit 14cee25
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion resources/vue/tree-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
>
<p class="filename" v-bind:data-hash="obj.hash">
<span v-show="hasChildren" v-on:click.stop="toggleCollapse" v-bind:class="indicatorClass"></span>
{{ obj.name }}<span v-if="hasDuplicateName" class="dir">&nbsp;({{ dirname }})</span>
{{ basename }}<span v-if="hasDuplicateName" class="dir">&nbsp;({{ dirname }})</span>
</p>
<Sorter v-if="isDirectory && combined" v-show="hover" v-bind:sorting="obj.sorting"></Sorter>
</div>
Expand Down Expand Up @@ -166,6 +166,18 @@ module.exports = {
}
return false
},
/**
* Copied over from file-item.vue: Used for looking for a frontmatter title property,
* and uses that as a filename if it is set.
*/
basename: function () {
if (this.obj.frontmatter && this.obj.frontmatter.hasOwnProperty('title')) {
return this.obj.frontmatter.title
} else {
return this.obj.name
}
},
/**
* returns true, if this is the current selected directory, there
* are search results and the sidebar is in combined mode
Expand Down

0 comments on commit 14cee25

Please sign in to comment.