Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

agnos.is Forums

  1. Home
  2. Tech
  3. How can I modify the DBsearch results page?

How can I modify the DBsearch results page?

Scheduled Pinned Locked Moved Tech
5 Posts 2 Posters 14 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D This user is from outside of this forum
    D This user is from outside of this forum
    [email protected]
    wrote on last edited by
    #1

    Hi,

    I'm going to change something on dbsearch results page:

    1. How can I add topic's thumb in there?
      525c4fe4-343a-467b-80cb-bdbe81b4837f-image.png

    2. How can I remove this shortcode?

    [embed-iframe] [{"name": "Video 1", "link": "https://www.youtube.com/embed/1cr_uPGOCeE?si=dc0ygHELF9Opgf9X"}]
    
    1 Reply Last reply
    0
    • D This user is from outside of this forum
      D This user is from outside of this forum
      [email protected]
      wrote on last edited by
      #2

      Anyone have idea for this case?

      1 Reply Last reply
      0
      • baris@community.nodebb.orgB This user is from outside of this forum
        baris@community.nodebb.orgB This user is from outside of this forum
        [email protected]
        wrote on last edited by
        #3

        You need to add the thumbs into the results using a hook from src/search.js 'filter:search.contentGetResult' should work, you can also replace the embed shortcode in the same hooks.

        To display the thumbs in the page you need to modify the template at https://github.com/NodeBB/nodebb-theme-harmony/blob/main/templates/partials/search-results.tpl and replace html with your own and use the thumbnails.

        1 Reply Last reply
        0
        • D This user is from outside of this forum
          D This user is from outside of this forum
          [email protected]
          wrote on last edited by
          #4

          @baris i finished for remove shortcode, but I don't see thumb when i debug data value

          filterSearchContentGetResult: async function (data) {
          		const posts = data.result.posts;
          		
          
          		for (let post of posts) {
          			post.content = post.content.replace(/^\[embed-iframe\].*$/gm, '');
          		}
          
          		return data;
          	},
          

          This is data value:

          {
              pid: 41238,
              tid: 41238,
              content: '<p dir="auto">content <br />\n' +
                '[embed-iframe] [{"name": "Video 1", "link": "https://www.youtube.com/embed/1cr_uPGOCeE?si=dc0ygHELF9Opgf9X"}]</p>\n',
              uid: 1,
              timestamp: 1735617649489,
              deleted: false,
              upvotes: 0,
              downvotes: 0,
              replies: 0,
              handle: undefined,
              votes: 0,
              timestampISO: '2024-12-31T04:00:49.489Z',
              user: {
                uid: 1,
                username: 'user',
                userslug: 'user',
                picture: null,
                status: 'online',
                uploadedpicture: undefined,
                lastonline: undefined,
                fullname: undefined,
                displayname: 'user',
                'icon:bgColor': '#673ab7',
                'icon:text': 'A',
                lastonlineISO: undefined
              },
              topic: {
                uid: 1,
                tid: 41238,
                title: 'embed logs',
                cid: 2,
                tags: [Array],
                slug: '41238/embed-logs',
                deleted: 0,
                scheduled: false,
                postcount: 1,
                mainPid: 41238,
                teaserPid: null,
                timestamp: 1735617649441,
                titleRaw: 'embed logs',
                timestampISO: '2024-12-31T04:00:49.441Z'
              },
              category: {
                cid: 2,
                name: 'General Discussion 5',
                icon: 'fa-comments-o',
                slug: '2/general-discussion-5',
                parentCid: 0,
                bgColor: '#59b3d0',
                color: '#ffffff',
                backgroundImage: '',
                imageClass: 'cover'
              },
              isMainPost: true
            },
          
          1 Reply Last reply
          0
          • baris@community.nodebb.orgB This user is from outside of this forum
            baris@community.nodebb.orgB This user is from outside of this forum
            [email protected]
            wrote on last edited by
            #5

            You need to load it yourself using the topic values and the method thumbs.load

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups