ysk24ok / jekyll-linkpreview

Jekyll plugin to generate link preview
https://rubygems.org/gems/jekyll-linkpreview
MIT License
29 stars 8 forks source link

Removing line 245 in jekyll-linkpreview.rb #30

Closed ChrisFiola closed 2 years ago

ChrisFiola commented 2 years ago

First of all great job on the plugin this is exactly what I needed and super simple. Only thing I need is to not have the URL show up on top of the preview.

When I build my website locally I just remove line 245 from jekyll-linkpreview.rb but when building though github-actions I cannot modify the ruby files since they are fetched from the source here.

Do you know how I could fix this without manually modifying my html after the website is deployed?

ysk24ok commented 2 years ago

Thank you for using this plugin. Have you tried custom templates? You can add a template file where the line is removed.

ysk24ok commented 2 years ago

@ChrisFiola Let me close this issue. If the custom template feature couldn't solve your problem, feel free to reopen it.

tayjaf commented 1 year ago

Hey ysk, love the plugin.

I'm looking to do the exact same thing here as Chris but when using custom templates, I end up with just lines of text instead of the proper preview output.

For example:

linkpreview.html:

{{ link_title }}
{{ link_image }}
{{ link_description }}
{{ link_domain }}

Result:

How Secure Is My Password? | Password Strength Checker https://www.security.org/app/uploads/2020/10/How-Secure-is-My-Password_.jpg Data breaches and identity theft are on the rise, and the cause is often compromised passwords. After stealing credentials, cybercriminals can use passwords to www.security.org

Am I writing the linkpreview.html incorrectly? Would appreciate any insight, thanks!

ysk24ok commented 1 year ago

@tayjaf Thank you for reporting this. Could you open a new issue as this one was created for a different purpose? In the new issue, could you provide

ysk24ok commented 1 year ago

@ChrisFiola v0.6.0 which deleted the line 245 has been released. Feel free to try it out.

Clpsplug commented 1 year ago

https://github.com/ysk24ok/jekyll-linkpreview/issues/30#issuecomment-1407755417

Hey @tayjaf, in case you did not catch the news, please try v0.6.0 to get rid of the URL before the preview.
Regarding the issue you reported, that is what jekyll-linkpreview (and Jekyll) is supposed to do; all the values ({{ link_* }}) are supposed to be strings, and whatever goes inside _includes are treated as parts of HTML. For them to be an actual preview, you need to write a snippet of HTML using the values given, like so:

<h2>{{ link_title }}</h2>
<p>{{ link_description }}</p>
<img src="{{ link_image }}" alt="Preview Image" />
<code>{{ link_domain }}</code>

This is minimal implementation; to use linkpreview.css as is, you need to consult the default template, which can be found here: https://github.com/ysk24ok/jekyll-linkpreview/blob/edd7909e94b3d394155f898b7a3a19aa109f7351/lib/jekyll-linkpreview.rb#L238-L273

and translate what's going on here to the Liquid template.

tayjaf commented 1 year ago

@Clpsplug Thanks so much, fixed my issues. Appreciate the help and insight.