Suggestion about the Link Preview component

Daniel DeSouza Posted in Component Development 5 years ago

Hi guys, i would like to see the Link Preview component to show the Title / Header of the article at the top of the post instead of the url link, it looks bad and unprofessional, it should be orgainzed Title> Image> Story: Hide url link!

Replies
German Michael Zülsdorff Replied 5 years ago

Okay,
so as a quick hack I tried OssnEmbed doing a little post-processing to hide standalone links and changed the following files:

https://github.com/githubertus/opensource-socialnetwork/blob/patch-78/components/OssnEmbed/vendors/linkify/linkify.php

See the logic at the bottom. Aside from that I added a second function param named $content_type on line 11 because the logic needs to be limited to work on posts only.

Consequently this new parm has to be passed when calling linkify from the com file, see line 52 of https://github.com/githubertus/opensource-socialnetwork/blob/patch-78/components/OssnEmbed/ossn_com.php

Honestly I'm not too happy of doing it this way, because dependencies between components are no good idea in general.

German Michael Zülsdorff Replied 5 years ago

Well,
currently LinkPreview's 'problem' is: It has no idea about your intention.

I agree that with posting a link only it doesn't make too much sense to see a link AND a preview below.
But what if you're posting something like ... I'd recommend to visit https://www.opensource-socialnetwork.org/wiki/all first and read the docs before opening a new topic in the forum?
In this case it in fact makes sense to keep the link in place because otherwise the posting would appear a little strange with the link inside the text being removed.

bb Daniel DeSouza Replied 5 years ago

Sure Arsalan,

When you copy a link for an article, and paste it into the OSSN network as a wall post with the Link Preview enabled, you will see the URL address link as the header. I want the URL link to be replaced by the actual header or title of the post.

Indonesian Arsalan Shah Replied 5 years ago

@Daniel, please explain this more, what exactly it means?
@David, its bit strange i will take a look.

ch David Exodus Replied 5 years ago

It would be also nice if the preview isn't shown when an image was added to the post. Otherwise it shows an image and a preview and that's confusing.