76 |
80 | 83 | 84 | Hashnode to Twitter 85 | 86 |
87 |88 | Post bite-sized summaries of your Hashnode blog post to 89 | increase reach 🚀 🚀 90 |
91 |114 | {errorMessage} 115 |
116 |153 | Edit tweets in a jiffy 154 |
155 |
156 | Make bite-sized tweet-threads from your articles while
157 | seeing the rich live tweet preview on the screen.
158 |
159 | Try it now:
160 |
173 |199 |174 |179 | 198 |175 | “Driving traffic to your blog is about as essential 176 | to your blogging success as your writing itself.” 177 |
178 |
208 | 238 | Create provocative, intriguing tweet threads 🧵 239 |
240 |241 | Twitter threads are one of the best ways to grow 242 | popular. Make irresistible tweet threads using popular 243 | #hashtags and emojis that bring traffic to your 244 | Hashnode blog. 245 |
246 |
264 | 273 | Your blog's reach - to the moon 🚀 🌙 274 |
275 |276 | Features of Hashnode to Twitter at a glance. 277 |
278 |287 | Post Thread 288 |
289 |290 | Convert your article summary to easy-to-consume tweet 291 | threads with CTA to your blog post. 292 |
293 |303 | Rich Live Preview 304 |
305 |306 | See the exact rich, live tweet preview of what you will 307 | tweet before actually tweeting it! All texts, mentions, 308 | links, hashtags, emojis are the exact same as Twitter. 309 |
310 |320 | Hashtags and emojis 321 |
322 |323 | Pick and use relevant #hashtags and emojis 👋 while 324 | posting your blog summary as Twitter threads. 325 |
326 |336 | Twitter Open Graph images 337 |
338 |339 | Twitter Open Graph images are fetched for URLs in each 340 | tweet. 341 |
342 |352 | Live character counter 353 |
354 |355 | Keep track of accurate character-count while editing 356 | tweets. 357 |
358 |368 | Fully responsive 369 |
370 |371 | App is fully usable in desktop and mobile devices. 372 |
373 |
17 |
18 |
19 | ### Edit and Preview Tweets screen
20 |
21 |
22 |
23 | ### Success Screen
24 |
25 |
26 |
27 |
28 | ## How to use
29 | 1. On the homepage of the app, login into Twitter.
30 | 2. Enter the URL of your Hashnode blog post and click on Fetch and Tweet.
31 | 3. On the Edit page, customize the tweets to your liking.
32 | 4. After editing and being satisfied with the preview, click on Tweet.
33 | 5. Your tweets will be tweeted in few seconds and you will be sent to the success screen.
34 | 6. On the success/done screen, you can see the posted tweets embedded.
35 |
36 | ## Tech used
37 | - Next.js
38 | - Tailwind CSS
39 | - Auth0
40 | - Twitter API
41 |
42 | ## How to run locally
43 | _Node.JS and npm must be installed. Download and install them from [here](https://nodejs.org/)._
44 |
45 | Follow these steps to run this project in your local computer.
46 |
47 | ```
48 | $ git clone https://github.com/geekysrm/hashnode-to-twitter.git
49 | $ cd hashnode-to-twitter
50 | $ npm i
51 | $ npm run dev
52 | ```
53 | Dev server will be running on port 3000.
54 |
55 | ## Contributions
56 | All contributions are welcome. Bugs and feedback can be raised on the Issues tab.
57 |
58 | ## Support
59 | If you like this and want to support my open-source work, please [buy me a coffee](https://coffee.soumya.dev/).
60 |
61 |
--------------------------------------------------------------------------------
/components/ImagePreview.js:
--------------------------------------------------------------------------------
1 | import axios from "axios";
2 | import { useEffect, useState } from "react";
3 | import Link from "./icons/Link";
4 |
5 | export default function ImagePreview({ link }) {
6 | if (!link || !link.includes("http")) {
7 | return <>>;
8 | }
9 | const [ogpData, setOgpData] = useState(null);
10 |
11 | useEffect(() => {
12 | axios
13 | .post("/api/fetchOgp", { url: link })
14 | .then((res) => {
15 | const { data } = res;
16 | if (data) {
17 | setOgpData(data.ogp);
18 | }
19 | })
20 | .catch((err) => setOgpData(null));
21 | }, []);
22 |
23 | useEffect(() => {
24 | axios.post("/api/fetchOgp", { url: link }).then((res) => {
25 | const { data } = res;
26 | if (data) {
27 | setOgpData(data.ogp);
28 | }
29 | });
30 | }, [link]);
31 |
32 | let title = "",
33 | description = "",
34 | imageUrl = "";
35 | if (ogpData) {
36 | title = ogpData?.twitter_card?.title || ogpData.title;
37 | description = ogpData?.twitter_card?.description || ogpData.description;
38 | if (description?.length >= 100) {
39 | description = description.substring(0, 95) + "...";
40 | }
41 | imageUrl =
42 | ogpData?.twitter_card?.images[0]?.url ||
43 | ogpData?.open_graph?.images[0]?.url ||
44 | "";
45 | }
46 | return ogpData && imageUrl ? (
47 |
43 |