<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Benjamin Price</title>
    <description>The latest articles on Forem by Benjamin Price (@benjaminjprice).</description>
    <link>https://forem.com/benjaminjprice</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F225704%2F15b0a941-5503-4b8c-91be-47c71e6daaa1.png</url>
      <title>Forem: Benjamin Price</title>
      <link>https://forem.com/benjaminjprice</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/benjaminjprice"/>
    <language>en</language>
    <item>
      <title>DEV Social Badge - Going Open-source!</title>
      <dc:creator>Benjamin Price</dc:creator>
      <pubDate>Tue, 25 Feb 2020 14:26:23 +0000</pubDate>
      <link>https://forem.com/benjaminjprice/dev-social-badge-going-open-source-5am0</link>
      <guid>https://forem.com/benjaminjprice/dev-social-badge-going-open-source-5am0</guid>
      <description>&lt;p&gt;I just open-sourced the codebase for the &lt;a href="https://benprice.dev/posts/intro-dev-social-badge/"&gt;DEV Social Badge&lt;/a&gt; that I've been working on. Check it out on &lt;a href="https://github.com/BenjaminPrice/dev-social-badge"&gt;GitHub&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;DEV Social Badge is an &lt;em&gt;unofficial&lt;/em&gt; social badge that queries the &lt;a href="https://dev.to/"&gt;DEV.to&lt;/a&gt; API to see if your blog post has been posted on DEV.&lt;/p&gt;

&lt;p&gt;This first release, &lt;a href="https://github.com/BenjaminPrice/dev-social-badge/releases/tag/v0.1.0"&gt;v0.1.0&lt;/a&gt;, should still be considered unstable and used at your own risk.&lt;/p&gt;




&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;An important requirement for this to work:&lt;/strong&gt; You must be using Canonical URLs on DEV.&lt;/p&gt;

&lt;p&gt;&lt;cite&gt;&lt;em&gt;This allows the code to determine which of your DEV posts matches the post hosting the badge.&lt;/em&gt;&lt;/cite&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Using the script
&lt;/h2&gt;

&lt;p&gt;Using the script is fairly straight forward. You have to add a couple of tags to your &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; and a couple in the &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt;, where you want the badge to appear.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding the script tag to the 
&lt;/h3&gt;

&lt;p&gt;Add the following script tag somewhere in your &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; to load the minified script.&lt;/p&gt;


&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- Place script tag before the end of the head tag --&amp;gt;&lt;br&gt;
&amp;lt;script src="&lt;a href="https://unpkg.com/dev-social-badge@0.1.0/dist/dev-social-badge.min.js"&gt;https://unpkg.com/dev-social-badge@0.1.0/dist/dev-social-badge.min.js&lt;/a&gt;"&amp;gt; &amp;lt;/script&amp;gt;&lt;br&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Adding the devbadge and script tags to the &lt;br&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;&amp;lt;devbadge /&amp;gt;&lt;/code&gt; will be replaced by the script with the social badge, if the script is able to find a matching post on DEV. If it doesn't return any matching posts, nothing gets added to your page.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;If you're using a template for your blog posts, I suggest adding this to the template file for your blog posts - not your main site layout.&lt;/em&gt; This will help to reduce unnecessary API calls to &lt;a href="https://dev.to/"&gt;DEV.to&lt;/a&gt;.&lt;/p&gt;



&lt;br&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- Place devbadge tag wherever you'd like the badge to appear --&amp;gt;&lt;br&gt;
&amp;lt;devbadge /&amp;gt;&lt;br&gt;
&amp;lt;!-- Place script tag before the end of the body tag --&amp;gt;&lt;br&gt;
&amp;lt;script&amp;gt;window.onload = function(){typeof findOnDev !== "undefined" &amp;amp;&amp;amp; findOnDev()}&amp;lt;/script&amp;gt;&lt;br&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  API Limits&lt;br&gt;
&lt;/h2&gt;

&lt;p&gt;Currently, there are no published limits on API calls. But, that doesn't mean that there isn't one. It's possible that this could stop functioning.&lt;/p&gt;

&lt;p&gt;Additionally, the DEV API &lt;a href="https://docs.dev.to/api/"&gt;documentation&lt;/a&gt; states that responses are cached for 24 hours. Don't expect your badge to show the positive reaction count in real-time.&lt;/p&gt;

&lt;h2&gt;
  
  
  You can help
&lt;/h2&gt;

&lt;p&gt;You don't need to write any code to help the project. Just giving the repository a ★Star on &lt;a href="https://github.com/BenjaminPrice/dev-social-badge"&gt;GitHub&lt;/a&gt; will help towards getting the project hosted on other CDNs, such as &lt;a href="https://cdnjs.com/"&gt;cdnjs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I will be adding &lt;a href="https://github.com/BenjaminPrice/dev-social-badge/issues"&gt;Issues&lt;/a&gt; to the repository for areas where I'd like some help, as well as to get my improvement ideas out of my head, over the next day or two. If you'd like to contribute to the code, please check out the &lt;a href="https://github.com/BenjaminPrice/dev-social-badge/blob/master/CONTRIBUTING.md"&gt;Contribution Guidelines&lt;/a&gt; (so far, they're quite sparse).&lt;/p&gt;

&lt;h2&gt;
  
  
  Let me hear from you
&lt;/h2&gt;

&lt;p&gt;Please share your thoughts in the comments thread on DEV. I'd love to get your feedback and opinions.&lt;/p&gt;




&lt;p&gt;This post &lt;a href="https://benprice.dev/posts/dev-social-badge-going-open-source/"&gt;originally appeared&lt;/a&gt; on &lt;a href="https://benprice.dev"&gt;benprice.dev&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>meta</category>
    </item>
    <item>
      <title>Introducing the DEV Social Badge</title>
      <dc:creator>Benjamin Price</dc:creator>
      <pubDate>Mon, 24 Feb 2020 13:29:41 +0000</pubDate>
      <link>https://forem.com/benjaminjprice/introducing-the-dev-social-badge-1bc3</link>
      <guid>https://forem.com/benjaminjprice/introducing-the-dev-social-badge-1bc3</guid>
      <description>&lt;p&gt;Today, I started working on a new social badge that pulls your reaction count for an article that’s been shared on DEV. I hope others like it and will find it useful.&lt;/p&gt;

&lt;p&gt;Before I get into everything, here’s what it looks like (you can see it in action on my (new) &lt;a href="https://benprice.dev"&gt;blog&lt;/a&gt;):&lt;/p&gt;

&lt;p&gt;&lt;a href="///static/4157eff7ac903eed10be1bae8cff1b5a/81690/dev-badge-sample.png"&gt;&lt;br&gt;
        &lt;br&gt;
        &lt;br&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--k14T0E34--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://benprice.dev/static/4157eff7ac903eed10be1bae8cff1b5a/81690/dev-badge-sample.png" alt="dev badge sample" title="Dev Social Badge - Sample"&gt;&lt;br&gt;
      &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The code still needs a bit more work before I’m ready to opensource it. But, I will be putting it up on GitHub, with directions on how to use it, in the next few days.&lt;/p&gt;

&lt;p&gt;The code is all written in pure JavaScript, to keep things nice and lightweight, and all of the badge is drawn with SVGs, including the Logo which &lt;a href="https://dev.to/ben/"&gt;Ben&lt;/a&gt; made available in this &lt;a href="https://gist.github.com/benhalpern/eff81b17359acafd17849146549b9291"&gt;gist&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Anyways, stay tuned for further updates over the next couple of days!&lt;/p&gt;




&lt;p&gt;This post &lt;a href="https://benprice.dev/posts/intro-dev-social-badge/"&gt;originally appeared&lt;/a&gt; on &lt;a href="https://benprice.dev"&gt;benprice.dev&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
