How to get custom discord embeds for github.io website? - discord

Source code
I just want to change some stuff like add a picture, change the colour of the blue strip, add some body text, etc.

Use these meta tags inside your index.html file <head> tags. You have used the og:title tag, use the other two.
<meta property="og:title" content="Write your desired title">
<meta property="og:description" content="Write the body text here">
<meta property="og:image" content="https://hypixelfarms.github.io/images/1.jpeg">
These are for social sharing which use the og property, unlike Search Engines.For more information visit this page of Css-Tricks.

Here's some Python code that will do what you're asking for. For color, set the variable to the hex code of any color you would like, and replace the # with 0x. I have provided an example one that sets it to green. You can get the color code from here.
#bot.command()
async def test(ctx):
embed = discord.Embed(
title="Farms and More",
url="https://hypixelfarms.github.io/",
description="body text",
color=0x4ef207
)
embed.set_thumbnail(url="") # enter the URL location of the picture to use for the embed picture
await ctx.send(embed=embed)
Go to this website for more detailed information on embed features.

Related

Reddit Link Thumbnail not Showing Dynamic og:image

I've got a NextJS app where users can share links to Reddit and the link preview in Reddit should show a different thumbnail based on the shared link. It works perfectly sharing to Slack or FB, but it always shows the exact same image on Reddit regardless of the link shared.
As you can see below, it should be sharing a different image based on the trade.id. However, on Reddit it always only shows the image for trade.id == 2 (this was the first one I shared for testing). I've tried using different accounts, but still the same problem.
const TradePage: React.FC<Props> = ({ trade }) => {
return (
<div>
<Head>
<meta
property='og:url'
content={`https://${URL}/trades/${trade.id}`}
/>
<meta
property='og:image'
content={`https://${URL}/images/Thumbnail${trade.id}.png`}
/>
<meta property='og:image:width' content='1200' />
<meta property='og:image:height' content='901' />
<meta
property='og:title'
content={`Verified ${trade.ticker} Trade`}
/>
<meta
property='og:image:alt'
content={`Verified ${trade.ticker} Trade`}
/>
<meta property='og:image:type' content='image/png' />
</Head>
<TradeComponent trade={trade} />
</div>
);
Reddit caches the OG image on the first request, as do a few other services like Twitter.
Twitter offers an OG testing tool to bust the cache - Reddit does not offer such a tool.
Unfortunately, your OG image is cached on Reddit for as long as they want to cache it or until they release a tool. However, it's been like this for a few years, and it doesn't look high on their priority.
A workaround is to change the URL for the page. For example, adding a trailing slash, query param, or renaming the route.

How to change the meta on each page individually in React

I am working on a project when the html.index file has the meta data. I.e. as follows:
<meta
property = "og: description"
content = "This is my web."
/>
Then when I post a link on WhatsApp or Slack I can see the description I wrote or more correctly the "slogan of the site".
How can I change the description when on the example page on the page "My projects" When I send the link in the description will be written "My projects".
Plus, I tried using React Helemnt but it does not work for me
<Helmet>
<title>{web.title}</title>
<description>My projects</description>
</Helmet>
Where am I wrong and what am I missing?

Displaying of html text in codenameone is very small

I am using browser component to display HTML text in my app. Everything was working fine before, but in recent build the font size displayed in browser component is very small.It works fine on simulator but on device it looks very small. Here is my test case and is tested on iPhone XS , iPhone 7 and iPad.
Form f= new Form();
f.setLayout(new BorderLayout());
BrowserComponent browser = new BrowserComponent();
Container cont = new Container();
cont.setLayout(new BorderLayout());
cont.addComponent(BorderLayout.CENTER, browser);
String data = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>Test</title><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" /></head><body><p>Hello World</p></body></html>";
browser.setPage(data, "");
cont.setPreferredH(com.codename1.ui.Display.getInstance().getDisplayHeight()/2);
browser.setPreferredH(com.codename1.ui.Display.getInstance().getDisplayHeight()/2);
f.addComponent(BorderLayout.CENTER,browser);
f.show();
Let me know what is been changed and how I can increase the size of font .
Thanks
I add an info to the Shai's answer about the font size.
Try to add the following meta tags:
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="MobileOptimized" content="width" />
<meta name="HandheldFriendly" content="true" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="cleartype" content="on" />
Hopefully these meta tags fixes the font sizes on real devices. In the CSSes used in web pages, I suggest to use the em as unit to specify the font sizes, because its mobile-device-friendly nature (independent from the dpi of the screen device).
Addendum: to don't confuse, while em is fine for CSSes used in web pages (inside a BrowserComponent), in the Codename One CSSes used to style Components it's better to use mm or pt as unit independent from dpi.
Apple started sending out warning emails to everyone who uses UIWebView so we toggled the switch to use WKWebView. This is something we wrote about a while back here: https://www.codenameone.com/blog/wkwebview.html
You generally shouldn't switch back but you should add a stylesheet to your HTML to explicitly determine the font size. That's the right way to do it on all occasions.

add raw html post to hugo not show up

I am using Academic theme. I wish to put some raw html page as post. but sounds like it doesn't show correctly on my post pages. my html page has title there!
<html>
<head>
<meta charset="utf-8">
<title>Example html post</title>
</head>
....
How show I change my theme to show my raw html posts?
First, you should know that Hugo (and any Markdown transpiler) will transpile any HTML tags in your markdown file to actual HTML tags in the HTML document.
Since code highlighting is supported in Hugo 0.28 and upwards, you can show your raw HTML code (or any code) just by surrounding your code with {{< highlight html >}} and {{< / highlight >}}
an example of this would be:
{{< highlight html >}}
<h1> Hello World! </h1>
{{< / highlight >}}
or for javascript:
{{< highlight js >}}
let hello = "Hello World!";
{{< / highlight >}}
For all the options available refer to this page.

How do I get the Google +1 button to give a preview of the article rather than the top HTML on the page?

Google Plus lists all your +1s with a small preview of the webpage that was +1ed. Techcrunch and Mashable's previews come up as the first sentence of the article, however for me it just takes the first HTML on the page (which in my case is navigation). How can I get it to target the article for this preview rather than the navigation?
I have looked through the API and couldnt find anything that would do what I'm talking about.
Well, you have three options to avoid G+ trying a best guess.
1) (prefered) Mark up your site with microdata. Please refer to http://schema.org and possibly the Google Webmaster Tools help section on microdata and the Opera Developer resources.
It will look something like:
<body itemscope itemtype="http://schema.org/Article">
<h1 itemprop="name">Article Title</h1> <!-- snippet title -->
<img itemprop="image" src="image-url"></img> <!-- the snippet icon -->
<p itemprop="description">Snippet text.</p>
</body>
The idea is to mark up the parts that you already uses as base for your snippet. Yahoo, MS Bing, Google and a few other search engines will try to honour this for their search snippets as well, as well as future browser versions, e.g. for bookmarks.
2) Use the facebook Open Graph protocol (which is not valid html, but makes your snippets compatible with facebook "shares").
It will look like (put this in your section)
<meta property="og:title" content="Your snippet title"/>
<meta property="og:image" content="url://of-your-snippet-image.jpeg"/>
<meta property="og:description" content="Your snippet text goes here"/>
3) Set the title and description meta tags.
<meta name="title" content="Your snippet title" />
<meta name="description" content="Your snippet text goes here">
Google finally released how to do it. http://developers.google.com/+/plugins/+1button/#plus-snippet
You need to use itemprop tags to tell +1 what you want to use.
There's many ways to go about it:
You can add the following tags to your opening HTML declaration:
<html itemscope itemtype="http://schema.org/Article">
and then add the following meta descriptors:
<meta itemprop="name" content="Your article's title" />
<meta itemprop="description" content="Your article's description or excerpt" />
and finally add this to the image you want to use:
<img itemprop="image" src="image.jpg" />

Resources