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 💗

  • Upgrade issues

    Solved Configure
    2
    2 Votes
    2 Posts
    136 Views

    Use this code

    git fetch # Grab the latest code from the NodeBB repository git checkout v3.x git reset --hard origin/v3.x

    And you will have the latest version without specifying it

    https://docs.nodebb.org/configuring/upgrade/

  • 1 Votes
    6 Posts
    188 Views

    Up to you really 🙂

  • 36 Votes
    55 Posts
    4k Views

    @DownPW I see why. The code relies on the existence of

    [component="topic/quickreply/container"]

    However, this by definition means that the below has to be enabled

    aeef638f-4188-489d-a9f2-f3a26dbca9d8-image.png

    It will then work

    7fb38631-e0f3-46ef-b652-00929d927b13-image.png

    For some unknown reason, this is hidden in Harmony, and only shows if you select it. In v2, it seems that the <section> is deleted altogether in Persona if “Quick Reply” is disabled, meaning it won’t fire as it can’t locate that specific component.

    The downside is that you might not want the quick reply function, but I think it’s a PITA to scroll up to the top of the post just to reply, so I have it on 🙂

  • 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.

  • 1 Votes
    2 Posts
    191 Views

    Closing this in favour of https://sudonix.com/topic/357/post-style-view/28

  • Bug Navbar CSS

    Solved Customisation
    3
    1 Votes
    3 Posts
    301 Views

    Not better way.

    Thanks.

  • CSS Help on my Flarum

    Solved Customisation
    5
    2 Votes
    5 Posts
    433 Views

    @mike-jones Yes, you’ll typically see this type of behaviour if there is another style that has higher priority in the sense that yours will be overridden. Using !important will override the higher preference, but should be used sparingly rather than everywhere.

  • 1 Votes
    6 Posts
    977 Views

    @jac said in [NodeBB] custom Gravatar image not showing:

    @phenomlab said in [NodeBB] custom Gravatar image not showing:

    @jac are you using Custom ?

    Sure am mate 👍🏻

    Confirmed Fixed