diff --git a/packages/server/src/services/MustacheService.ts b/packages/server/src/services/MustacheService.ts index 12b7cddda..ba703d5e8 100644 --- a/packages/server/src/services/MustacheService.ts +++ b/packages/server/src/services/MustacheService.ts @@ -18,6 +18,7 @@ export interface RenderOptions { export interface View { name: string; title: string; + titleOverride?: boolean; path: string; layout?: string; navbar?: boolean; @@ -187,7 +188,7 @@ export default class MustacheService { const layoutView: any = { global: globalParams, pageName: view.name, - pageTitle: `${config().appName} - ${view.title}`, + pageTitle: view.titleOverride ? view.title : `${config().appName} - ${view.title}`, contentHtml: contentHtml, cssFiles: cssFiles, jsFiles: jsFiles, diff --git a/packages/server/src/utils/joplinUtils.ts b/packages/server/src/utils/joplinUtils.ts index eb8c9ef14..553e3520e 100644 --- a/packages/server/src/utils/joplinUtils.ts +++ b/packages/server/src/utils/joplinUtils.ts @@ -1,5 +1,4 @@ import JoplinDatabase from '@joplin/lib/JoplinDatabase'; -// import Logger from '@joplin/lib/Logger'; import BaseModel, { ModelType } from '@joplin/lib/BaseModel'; import BaseItem from '@joplin/lib/models/BaseItem'; import Note from '@joplin/lib/models/Note'; @@ -25,6 +24,8 @@ import Setting from '@joplin/lib/models/Setting'; import { Models } from '../models/factory'; import MustacheService from '../services/MustacheService'; import Logger from '@joplin/lib/Logger'; +import config from '../config'; +const { substrWithEllipsis } = require('@joplin/lib/string-utils'); const logger = Logger.create('JoplinUtils'); @@ -81,9 +82,6 @@ export async function initializeJoplinUtils(config: Config, models: Models, must BaseItem.loadClass('NoteTag', NoteTag); BaseItem.loadClass('MasterKey', MasterKey); BaseItem.loadClass('Revision', Revision); - - // mustache_ = new MustacheService(config.viewDir, config.baseUrl); - // mustache_.prefersDarkEnabled = false; } export function linkedResourceIds(body: string): string[] { @@ -148,7 +146,7 @@ async function noteLinkedItemInfos(userId: Uuid, itemModel: ItemModel, note: Not output[jopId] = { item: itemModel.itemToJoplinItem(item), - file: null,// itemFileWithContent.file, + file: null, }; } @@ -213,7 +211,8 @@ async function renderNote(share: Share, note: NoteEntity, resourceInfos: Resourc cssFiles: ['items/note'], jsFiles: ['items/note'], name: 'note', - title: 'Note', + title: `${substrWithEllipsis(note.title, 0, 100)} - ${config().appName}`, + titleOverride: true, path: 'index/items/note', content: { note: {