@@ -34,29 +34,41 @@ export function createNoteObject(bookmark, account, domain) {
34
34
updatedBookmark . title = escapeHTML ( bookmark . title ) ;
35
35
updatedBookmark . description = escapeHTML ( bookmark . description ) ;
36
36
37
- const linkedTags = bookmark . tags
38
- ?. split ( ' ' )
39
- . map ( ( tag ) => {
40
- const tagName = tag . slice ( 1 ) ;
41
- return `<a href="https://${ domain } /tagged/${ tagName } " class="mention hashtag" rel="tag nofollow noopener noreferrer">${ tag } </a>` ;
42
- } )
43
- . join ( ' ' ) ;
37
+ let linkedTags = '' ;
38
+
39
+ if ( bookmark . tags && bookmark . tags . length > 0 ) {
40
+ linkedTags = bookmark . tags
41
+ ?. split ( ' ' )
42
+ . map ( ( tag ) => {
43
+ const tagName = tag . slice ( 1 ) ;
44
+ return `<a href="https://${ domain } /tagged/${ tagName } " class="mention hashtag" rel="tag nofollow noopener noreferrer">${ tag } </a>` ;
45
+ } )
46
+ . join ( ' ' ) ;
47
+ }
48
+
49
+ if ( updatedBookmark . description ?. trim ( ) . length > 0 ) {
50
+ updatedBookmark . description = `<br/>${ updatedBookmark . description ?. trim ( ) . replace ( '\n' , '<br/>' ) || '' } ` ;
51
+ }
52
+
53
+ if ( linkedTags . trim ( ) . length > 0 ) {
54
+ linkedTags = `<p>${ linkedTags } </p>` ;
55
+ }
44
56
45
57
const noteMessage = {
46
58
'@context' : 'https://www.w3.org/ns/activitystreams' ,
47
59
id : `https://${ domain } /m/${ guidNote } ` ,
48
60
type : 'Note' ,
49
61
published : d . toISOString ( ) ,
50
62
attributedTo : `https://${ domain } /u/${ account } ` ,
51
- content : `<strong><a href="${ updatedBookmark . url } " rel="nofollow noopener noreferrer" target="_blank ">${ replaceEmptyText (
63
+ content : `<p>< strong><a href="${ updatedBookmark . url } " rel="nofollow noopener noreferrer">${ replaceEmptyText (
52
64
updatedBookmark . title ,
53
65
updatedBookmark . url ,
54
- ) } </a></strong><br/> ${ updatedBookmark . description ?. trim ( ) . replace ( '\n' , '<br/>' ) || '' } < p>${ linkedTags } </p> `,
66
+ ) } </a></strong>${ updatedBookmark . description } </ p>${ linkedTags } `,
55
67
to : [ `https://${ domain } /u/${ account } /followers/` , 'https://www.w3.org/ns/activitystreams#Public' ] ,
56
68
tag : [ ] ,
57
69
} ;
58
70
59
- updatedBookmark . tags ?. split ( ' ' ) . forEach ( ( tag ) => {
71
+ bookmark . tags ?. split ( ' ' ) . forEach ( ( tag ) => {
60
72
const tagName = tag . slice ( 1 ) ;
61
73
noteMessage . tag . push ( {
62
74
type : 'Hashtag' ,
0 commit comments