Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
October 20, 2019 10:07 pm GMT

I made DEV.to widget for websites/blogs

Hey Everyone! So I made an (Unofficial) DEV.to widget / profile-card which you can use in your websites and blogs (You just have to copy-paste 2 lines of code :D).

Here's how it looks like

Usage ( JUST 2 LINES OF CODE :D )

    <dev-widget data-username="saurabhdaware"></dev-widget>    <!-- Place script tag before the end of the body tag -->    <script src="https://unpkg.com/[email protected]/dist/card.component.mjs" type="module"></script>

And BOOM that's it! Just put your dev.to username in data-username attribute and you will get your profile card :D

If you want to install it as ES6 module (Mostly used in frameworks)

npm install --save dev-widget

and import at the top of your file

import 'dev-widget'

Then you can use

<dev-widget data-username="saurabhdaware"></dev-widget>

There are some other attributes like data-width, data-limit You can checkout full documentation on my GitHub:

GitHub logo saurabhdaware / DEV-widget

Unofficial Widget/profile card for https://dev.to/

DEV widget

GitHub package.json version Contributions to DEV Widget are welcomed

Codepen: https://codepen.io/saurabhdaware/pen/NWWbOvv

Unofficial Widget / profile card for dev.to.

You can use it in your website/blog and show off your DEV.to articles

Screenshot of the DEV.to Widget

Installation and Usage

- Through script tag

    <dev-widget data-username="saurabhdaware"></dev-widget&gt    <!-- Place script tag before the end of the body tag -->    <script src="https://unpkg.com/[email protected]/dist/card.component.mjs" type="module"></script>

- As NPM module

This can be used in React, Vue and almost any other frontend framework

npm install --save dev-widget

Inside your framework component

import 'dev-widget'

Attributes Guide

attributesdescriptiondefault
data-usernameYour DEV.to Username
data-widthWidth of the card300px
data-name (optional)Name to display on cardWill be fetched from API
data-limitNumber of articles to display30

Note: Value of data-limit should not be too high. An API request has to be made

Do the repository

Also, for the hacktoberfest, if anyone wants to contribute to this project, I would love to help. You can checkout CONTRIBUTING.md for contribution guidelines.


Original Link: https://dev.to/saurabhdaware/i-made-dev-to-widget-for-websites-blogs-40p2

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To