Skip to content

CSS code customization for the link preview plugin

Solved Customisation
  • Hi @phenomlab ,

    I am working on CSS codes to customize the link-preview plugin for some time, but I was unsuccessful 😄 so, I wanted to consult you in case I am missing an important line…

    Unfortunately, normal previews of this plugin are too big for our taste, just like how iframely used to be…

    https://sudonix.org/post/4083

    I ended up something like this:

    .post-container .content .card {
        display: contents !important;  
    }
    
    .link-preview {
        
        .card-img-top {
            height:120px !important;
            width: auto !important;
            overflow: hidden !important;        
            float: left !important;
            padding: 0 5px 0 0 !important;      
        }
        
        .card-body {
            padding: 1px 1px 1px 1px !important;
        }
        
        .card-footer {
            position: relative !important;    
        }
    }
    

    But this is nowhere near close to what I was aiming…

    This is how it used to be with iframely and what we are aiming:
    Screenshot 2024-04-02 at 22.04.41.png

    This is how ugly it looks right now 😄

    Screenshot 2024-04-02 at 22.02.51.png

    I hope you can help with this transformation 😄
    Thanks,

  • @crazycells technically possible, yes - I can get somewhere near the desired layout as below

    7b646096-5c21-44a1-b283-54d6f94e579b-image.png

    However, this isn’t great from the CSS perspective as it’s something of a hack, and will not look good on mobile devices. Here’s the CSS for that if you want to use it.

    .post-container .content .card {
        display: contents !important;  
    }
    .link-preview .card-title {
        margin-left: -238px;
        float: left;
    }
    .link-preview .card-img-top {
        height: 120px !important;
        width: auto !important;
        overflow: hidden !important;
        float: left !important;
        padding: 0 5px 0 0 !important;
        margin-top: 35px;
    }
    .link-preview .card-text {
        margin-top: 20px;
        padding-left: 15px;
    }
    .link-preview .card-footer {
        position: relative !important;
        margin-top: 70px;
    }
    .link-preview .card-body {
        padding: 1px 1px 1px 1px !important;
    }
    .link-preview .card-text {
        margin-top: 35px;
        padding-left: 15px;
    }
    
    

    The real issue with nodebb-plugin-link-preview is that it has no flexibility in terms of HTML layout meaning you have to get clever with CSS (and even then, it’s not clever at all).

    Using my OGProxy function, it would look like this by default

    https://community.nodebb.org/topic/17109/manual-build-a-night-mode-for-harmony

    However, because you have control over the HTML, you can simply rearrange it to suit your own needs.

  • phenomlabundefined phenomlab has marked this topic as solved on
  • @phenomlab does OGProxy show the pdf previews as well?

  • @crazycells said in CSS code customization for the link preview plugin:

    does OGProxy show the pdf previews as well?

    Not yet, but it could with a bit of additional code.


Did this solution help you?
Did you find the suggested solution useful? Why not buy me a coffee? It's a nice gesture, and a great way to show your appreciation 💗

  • 5 Votes
    4 Posts
    483 Views

    @DownPW thanks. I forgot about that.

  • SEO and Nodebb

    Performance
    2
    2 Votes
    2 Posts
    143 Views

    @Panda It’s the best it’s ever been to be honest. I’ve used a myriad of systems in the past - most notably, WordPress, and then Flarum (which for SEO, was absolutely dire - they never even had SEO out of the box, and relied on a third party extension to do it), and NodeBB easily fares the best - see below example

    https://www.google.com/search?q=site%3Asudonix.org&oq=site%3Asudonix.org&aqs=chrome..69i57j69i60j69i58j69i60l2.9039j0j3&sourceid=chrome&ie=UTF-8#ip=1

    However, this was not without significant effort on my part once I’d migrated from COM to ORG - see below posts

    https://community.nodebb.org/topic/17286/google-crawl-error-after-site-migration/17?_=1688461250365

    And also

    https://support.google.com/webmasters/thread/221027803?hl=en&msgid=221464164

    It was painful to say the least - as it turns out, there was an issue in NodeBB core that prevented spiders from getting to content, which as far as I understand, is now fixed. SEO in itself is a dark art - a black box that nobody really fully understands, and it’s essentially going to boil down to one thing - “content”.

    Google’s algorithm for indexing has also changed dramatically over the years. They only now crawl content that has value, so if it believes that your site has nothing to offer, it will simply skip it.

  • 2 Votes
    26 Posts
    1k Views

    @Panda said in Interesting Widget code, but can’t fetch API:

    How did you drop that widget into the post there?
    I hadnt seen this BSgenerator anywhere on sudonix site, do you use it somewhere already?

    Yes, here

    https://sudonix.org/topic/414/corporate-bullshit-generator?_=1687774393044

    It’s not a “post” or “topic” in the common sense. It is actually a page in it’s own right and leverages nodebb-plugin-custom-pages. This in turn creates a new “route” which behaves like a page, meaning it is then exposed for widgets.

    @Panda said in Interesting Widget code, but can’t fetch API:

    Also can you explain more what you mean by calling the code externally. In my API call example, how would I go about doing that?

    By this, I mean create all the required code in an external JS file that is reachable by the NodeBB instance - so, in “public” for example - or in my case /public/js. The widget then “calls” that file and because it runs outside of the scope of NodeBB, you just need to return the values to the widget.

    Hope this makes sense?

  • restarting nodebb on boot

    Unsolved Configure
    3
    1 Votes
    3 Posts
    219 Views

    @eeeee said in restarting nodebb on boot:

    can I just run nodebb under nodemon for auto restarts?

    It’s a better method. Nodemon just looks for file system changes and would effectively die if the server was rebooted meaning you’d have to start it again anyway. Systemd is the defacto standard which is how the operating system interacts in terms of services, scheduled tasks etc.

  • 3 Votes
    11 Posts
    708 Views

    @cagatay no problems

  • Error install plugin

    Solved Customisation
    8
    1 Votes
    8 Posts
    461 Views

    @pobojmoks

    Not WP plugin but nodeBB but it a known bug

  • 2 Votes
    12 Posts
    664 Views

    It’s worth adding @qwinter that 2.x is now completely stable.

  • nodebb dropdown menu

    Solved Configure
    5
    0 Votes
    5 Posts
    428 Views

    @phenomlab said in nodebb dropdown menu:

    @kurulumu-net You set it like the below example taken from this site

    aae36790-3257-4bb2-ad5a-0d744309876a-image.png

    Which presents this

    77f47260-2941-4afe-9614-8e17dcfc8c19-image.png

    Very interesting…

    I actually thought this wasn’t possible, as I remember it being asked in the NodeBB forum.

    Is this something new that’s been implemented? I’ll 100% be doing that when I’m on the laptop over the weekend.