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 💗

Related Topics
  • 2 Votes
    2 Posts
    195 Views
    @dave1904 that’s a really good point actually. I know it was there previously on Persona, but you’re right - no such function exists on harmony. However, putting something in place to mimick the behaviour of Persona won’t be hard from the js standpoint, although I wonder if perhaps we should ask the NodeBB developers is this feature was overlooked?
  • Header Menu After Upgrading V3.1.1

    Solved Customisation
    2
    +0
    2 Votes
    2 Posts
    202 Views
    @cagatay this relates to a change the css classes used for the brand header meaning it will now float to the left instead of right. If you’d like to retain the original behavior, you can add this css class [data-widget-area="brand-header"] { justify-content: end; display: flex; } Further information here https://community.nodebb.org/topic/17090/manual-build-a-custom-header-in-harmony/19?_=1684069325296
  • answers appearance css code request

    Solved Customisation
    11
    +0
    1 Votes
    11 Posts
    875 Views
    @DownPW yes, because of the modifications that Sudonix uses, you’ll need to tailor to fit your needs.
  • Plugin Install Error

    Solved Customisation
    6
    +0
    2 Votes
    6 Posts
    606 Views
    @Sampo2910 no problems. Happy to help. Just remember that this particular method isn’t the best in the sense that it may not get update notifications. The general recommendation here would be to move back to the official npm repo as soon as the GitHub version has been merged. For the meantime, it’ll work fine though.
  • CSS3: Gradient Generator

    Development
    1
    1 Votes
    1 Posts
    228 Views
    No one has replied
  • Recent Cards plugin customization

    Solved Customisation
    21
    +0
    13 Votes
    21 Posts
    3k Views
    @pobojmoks that’s easily done by modifying the code provided here so that it targets background rather than border In essence, the below should work $(document).ready(function() { $(window).on('action:ajaxify.end', function(data) { $('.recent-card-container').each(function(i) { var dataId = $(this).attr("data-cid"); var color = $('[role="presentation"]', this).css("background-color"); console.log("data-cid " + dataId + " is " + color); $('[data-cid="' + dataId + '"] .recent-card').attr("style", "background-color: " + color); }); }); });
  • IRC Server/Client - Chat App with NodeBB

    Linux
    6
    1 Votes
    6 Posts
    832 Views
    @Hari not sure from the consumer perspective, but Skype has been all but completely consumed by Microsoft Teams when it comes to business usage.
  • [NodeBB] Import custom Font

    Solved Customisation
    12
    3 Votes
    12 Posts
    1k Views
    @cagatay you’ll need to define this in the body tag (or another element if you want greater or more granular targets) - for example body { font-family: "Poppins"; font-size: 16px; } Essentially, you use the font-size CSS directive.