<?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>DEV Community: Igor</title>
    <description>The latest articles on DEV Community by Igor (@ygrik).</description>
    <link>https://dev.to/ygrik</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%2F374427%2F7a07e997-0ee9-4d63-a31c-d6683c4f9aea.jpg</url>
      <title>DEV Community: Igor</title>
      <link>https://dev.to/ygrik</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ygrik"/>
    <language>en</language>
    <item>
      <title>Drag and drop content editor for a static website on Netlify</title>
      <dc:creator>Igor</dc:creator>
      <pubDate>Tue, 28 Apr 2020 01:47:22 +0000</pubDate>
      <link>https://dev.to/ygrik/drag-and-drop-content-editor-for-a-static-website-on-netlify-57e9</link>
      <guid>https://dev.to/ygrik/drag-and-drop-content-editor-for-a-static-website-on-netlify-57e9</guid>
      <description>&lt;h1&gt;
  
  
  Overview
&lt;/h1&gt;

&lt;p&gt;In this post, I’m going to show how you can quickly set up drag and drop editor and hosting, for a static website with &lt;a href="https://paperbits.io"&gt;Paperbits&lt;/a&gt; content builder and &lt;a href="https://www.netlify.com"&gt;Netlify&lt;/a&gt; for free. &lt;/p&gt;

&lt;h1&gt;
  
  
  What is it Paperbits
&lt;/h1&gt;

&lt;p&gt;In most cases, if we want to run a blog website or a simple landing page we must have to be able to understand and code CSS, HTML, or even Javascript. Paperbits is an open-source project that gives developers the possibility to build a tool for users to simplify the process of web content creation without knowledge of templating languages like &lt;a href="http://handlebarsjs.com"&gt;Handlebars&lt;/a&gt; or markup like Markdown.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Paperbits works
&lt;/h2&gt;

&lt;p&gt;Paperbits is following the &lt;a href="https://jamstack.org"&gt;JAMstack&lt;/a&gt; approach. JAMstack is a modern web development architecture based on client-side JavaScript, reusable APIs, and prebuilt Markup. These three core components used to create websites that are both fast and highly dynamic. &lt;/p&gt;

&lt;p&gt;JAMstack based on decoupling a web content building and hosting steps. In most cases, web content builds with a static page generator. The page generator creates a website that you can deploy and host anywhere. The simplest solution is hosting static pages on cloud storage service and a content delivery network (CDN). &lt;/p&gt;

&lt;p&gt;Currently, most JAMstack static site generators are heavily geared towards developers "for developers by developers". If we want to create a web page, we must follow a particular folder structure and setup code editor for CSS, HTML, JavaScript, or markup like Markdown. There are almost no options for non-developers (for example web designers, content creators) who are familiar with how HTML, CSS work but want to avoid edit them by hand. Now, this type of person has an option to use the Paperbits drag and drop content builder.&lt;/p&gt;

&lt;p&gt;Paperbits has two parts the visual editor and publisher (static site generator). In Paperbits visual editor you are abstracted from coding HTML by the drag and drop content builder and enhancing appearance by managing the style guide. The editor is a web app where we can create/edit web pages, manage styles, layouts, and navigation without touching code. All created content, the editor store as metadata in a &lt;a href="https://www.json.org"&gt;JSON&lt;/a&gt; file. After you are done with editing and like what you see in the editor (this is exactly what you get), you are ready for publishing your website. The publisher is a static site generator. It uses saved metadata JSON file to generate pages and copy media files in the result folder that you can deploy and serve as a website.&lt;/p&gt;

&lt;p&gt;You can get more details on &lt;a href="https://paperbits.io"&gt;Paperbits website&lt;/a&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why Netlify
&lt;/h1&gt;

&lt;p&gt;Netlify is well known as a home for JAMstack frameworks. Netlify provides a simple and fast platform for static website hosting. It has everything that you need for our static websites like custom domain, free SSL with Let's Encrypt, and automatic deployment from linked GitHub repository. We can use all these for free on the Starter plan.&lt;/p&gt;

&lt;h1&gt;
  
  
  Prerequisites
&lt;/h1&gt;

&lt;p&gt;To run and edit your website we need Netlify and GitHub accounts.&lt;/p&gt;

&lt;p&gt;In GitHub, we need to fork the &lt;strong&gt;paperbits-demo&lt;/strong&gt; repository  &lt;a href="https://github.com/paperbits/paperbits-demo"&gt;https://github.com/paperbits/paperbits-demo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The fork gives us an option to get the latest updates from the paperbits-demo repository. How to fork a repository you can find on GitHub &lt;a href="https://help.github.com/en/github/getting-started-with-github/fork-a-repo"&gt;https://help.github.com/en/github/getting-started-with-github/fork-a-repo&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Setup and deploy a site with Netlify
&lt;/h1&gt;

&lt;p&gt;Login on the Netlify portal and create a site from the forked repository in GitHub. We can easily do it by open the Sites tab and click the button &lt;strong&gt;New site from Git&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--koySJ5vt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/02g5qhc4vwblroqjev6k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--koySJ5vt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/02g5qhc4vwblroqjev6k.png" alt="netlify site from git"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We should follow 3 simple steps: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;connect to our GitHub account&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;select the forked repository from the paperbits-demo&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;provide build settings for our site&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On the first step, we should select GitHub, authorize Netlify access to our GitHub account. On the second step select a repository from the list. &lt;/p&gt;

&lt;p&gt;In my case, I see &lt;strong&gt;ygrik&lt;/strong&gt; GitHub account and &lt;strong&gt;ygrik/paperbits-demo&lt;/strong&gt; repository&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--t4GzpVHm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qsjcijiu0cc6v0biuwns.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t4GzpVHm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qsjcijiu0cc6v0biuwns.png" alt="netlify github account"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the last step, you should select the branch, build command, and publish directory. &lt;/p&gt;

&lt;p&gt;To build Paperbits site we need to run NPM command: &lt;strong&gt;npm run publish&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After build completion, all files for our static site will be in &lt;strong&gt;dist/website&lt;/strong&gt; directory and ready to serve.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3iH1txj6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/u2fz7qyb6pj8ii6amiqz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3iH1txj6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/u2fz7qyb6pj8ii6amiqz.png" alt="netlify build"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We are ready to deploy our website. Just click the button &lt;strong&gt;Deploy site&lt;/strong&gt; and Netlify will run provided build command and in a couple of minutes serve our static site on netlify.com subdomain. &lt;/p&gt;

&lt;p&gt;I changed the random site name to &lt;strong&gt;paperbits&lt;/strong&gt; and my site now hosts on &lt;a href="https://paperbits.netlify.app"&gt;https://paperbits.netlify.app&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can open this link in a browser and see the Paperbits website.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Zx-NS7EQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2ez9ou0dfvd1hmkg7zpq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Zx-NS7EQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2ez9ou0dfvd1hmkg7zpq.png" alt="paperbits site"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Setup and deploy an editor for our site
&lt;/h1&gt;

&lt;p&gt;To run editor for our website we need to create one more site in Netlify. &lt;/p&gt;

&lt;p&gt;For this, we should repeat the first two steps for the same forked repository. The only difference will be in settings for the build command and publish directory.&lt;/p&gt;

&lt;p&gt;To build Paperbits editor we need to run NPM command: &lt;strong&gt;npm run build-designer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After build completion, all editor files will be in &lt;strong&gt;dist/designer&lt;/strong&gt; directory and ready to serve.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--e2L1Xg7m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/f6w4oprbqm0ydm8d6vm7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--e2L1Xg7m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/f6w4oprbqm0ydm8d6vm7.png" alt="netlify deploy"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click the button &lt;strong&gt;Deploy site&lt;/strong&gt; and Netlify builds and serves our editor as a site on the netlify.com subdomain. &lt;/p&gt;

&lt;p&gt;I changed the random site name to &lt;strong&gt;paperbits-editor&lt;/strong&gt; and my editor now host on &lt;a href="https://paperbits-editor.netlify.app"&gt;https://paperbits-editor.netlify.app&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can open this link in a browser and see the Paperbits website in the editor.&lt;/p&gt;

&lt;h1&gt;
  
  
  Build content with Paperbits editor.
&lt;/h1&gt;

&lt;p&gt;Now we are ready to create our website content. By default, our editor loads the Paperbits website. The metadata file for it located in the repository &lt;strong&gt;src/data/demo.json&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;This JSON file is like a project file for a website. In the beginning, I offer to start from an empty website, you can download the metadata file from URL&lt;/p&gt;

&lt;p&gt;&lt;a href="https://cdn.paperbits.io/blog/templates/empty.json"&gt;https://cdn.paperbits.io/blog/templates/empty.json&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and overwrite &lt;strong&gt;demo.json&lt;/strong&gt; content with &lt;strong&gt;empty.json&lt;/strong&gt;, commit, and push this change to our GitHub repository. After push Netlify triggers the build and publishes the latest changes for our website and editor.&lt;/p&gt;

&lt;p&gt;Reload our editor and it loads the empty website. This site has three empty pages, one layout, default style guide, and a menu with navigation between pages.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IFrXDHI8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5d7177w208a99grw9yz1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IFrXDHI8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5d7177w208a99grw9yz1.png" alt="Paperbits editor"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you do not want to commit each change to GitHub and reduce usages of build minutes (Netlify give you 300 build minutes/month on Started tier), you can save website changes locally with keyboard shortcut &lt;strong&gt;Ctrl + S&lt;/strong&gt; and load saved changes in Paperbits editor from file with keyboard shortcut &lt;strong&gt;Ctrl + O&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Media files
&lt;/h2&gt;

&lt;p&gt;We can start building a website by adding images to the media library. Our images must be available for the Netlify build service to download them on the publishing step. I use CDN for my images and link files as a reference URL in the media library.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---9Te-ROq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/c0lifp63rcq24rf0y0tk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---9Te-ROq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/c0lifp63rcq24rf0y0tk.png" alt="Add media"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can use any web-accessible media files as a reference on cloud storage, One Drive, Google Drive, Dropbox, etc.&lt;/p&gt;

&lt;p&gt;We can not use the &lt;strong&gt;Upload file&lt;/strong&gt; option because of Paperbits demo has settings to store a file in the browser memory and it is not accessible on the publishing step. You can change this in code by overriding behavior in StaticBlobStorage.ts&lt;/p&gt;

&lt;h2&gt;
  
  
  Simple content editing
&lt;/h2&gt;

&lt;p&gt;On the &lt;strong&gt;Home&lt;/strong&gt; page, I removed default text (select text widget and delete) and add a section with two articles, one for image and one for text. Just hover mouse on content and find a blue plus button. Click it and select a preset for two articles layout. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R70E63Zw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/9hlcp8pzrbd55s76jxjt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R70E63Zw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/9hlcp8pzrbd55s76jxjt.png" alt="Add section"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have several presets for a section layout for most cases. If you do not like the last changes you can use Undo/Redo buttons in the left bottom corner. &lt;/p&gt;

&lt;p&gt;Hover the mouse pointer on the left article, click the gray plus button and select the picture widget.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--znTfLZKS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/iseizsbqkjsu2zbyxfxd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--znTfLZKS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/iseizsbqkjsu2zbyxfxd.png" alt="Add picture widget"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open picture widget editor by double click on the added picture placeholder. Click on the source placeholder and select an image from the media library.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZUCHEO62--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/jr956kxa2uyuopcho7h1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZUCHEO62--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/jr956kxa2uyuopcho7h1.png" alt="Select image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Add a text widget in the right article and replace the default text. Click the preview button in the right top corner and review what you did.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TW8sD2Bg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fhdx61ta5ratseswc7di.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TW8sD2Bg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fhdx61ta5ratseswc7di.png" alt="result preview"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Save our changes with &lt;strong&gt;Ctrl + S,&lt;/strong&gt; update content for &lt;strong&gt;src/data/demo.json&lt;/strong&gt;, and push changes to the GitHub repo. Netlify will do the publishing job and your website goes live for everybody.&lt;/p&gt;

&lt;p&gt;The project metadata file for this example website available by this URL&lt;br&gt;
&lt;a href="https://cdn.paperbits.io/blog/templates/animals.json"&gt;https://cdn.paperbits.io/blog/templates/animals.json&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can load this website in your Paperbits editor and play with it.&lt;/p&gt;

&lt;p&gt;If you want to run this solution locally you find more details here &lt;a href="https://paperbits.io/wiki/getting-started"&gt;https://paperbits.io/wiki/getting-started&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;In this post, I described how to build and host a simple static website with no-code cloud solution based on Paperbits visual content builder, Github, and Netlify for free. I showed how to set up step by step the whole solution on GitHub and Netlify services. &lt;/p&gt;

&lt;p&gt;Now you can share the JSON metadata file with your web designer, content writer, and build website content without coding CSS and Html. In the example website, I used a small set of the Paperbits editor functionality and did not touch the powerful widget extensibility option. &lt;/p&gt;

&lt;p&gt;To be continued...&lt;/p&gt;

</description>
      <category>jamstack</category>
      <category>visualeditor</category>
      <category>contentbuilder</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
