{"id":10090,"date":"2021-09-20T13:45:06","date_gmt":"2021-09-20T13:45:06","guid":{"rendered":"https:\/\/linuxways.net\/?p=10090"},"modified":"2021-09-20T13:45:06","modified_gmt":"2021-09-20T13:45:06","slug":"how-to-install-11ty-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-11ty-on-ubuntu-20-04\/","title":{"rendered":"How to Install 11ty on Ubuntu 20.04"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>11ty is a NodeJS-based powerful static site generator. In this tutorial, I will walk you through step by step and show you how to install 11ty on your Ubuntu system and generate static websites. I am using Ubuntu 20.04 Edition. All instructions and commands only apply to Ubuntu.<\/p>\n<h2>Prerequisites<\/h2>\n<p>As a Linux user you should have the following two packages available on your system.<\/p>\n<p>~ NodeJS<\/p>\n<p>~ NPM<\/p>\n<p>If you do not have them at this time. Install them with the following commands:<\/p>\n<pre><strong>$ sudo apt update<\/strong><\/pre>\n<pre><strong>$ sudo apt install node<\/strong><\/pre>\n<pre><strong>$ sudo apt install npm<\/strong><\/pre>\n<p>Without Node.js and NPM, you won\u2019t be able to continue working with 11ty.<\/p>\n<p>The best thing about 11ty is that you do not need to install it like other node packages. For now, let\u2019s create a new directory, move into it, and initialize it, respectively.<\/p>\n<pre><strong>$ mkdir newEleventySite<\/strong><\/pre>\n<pre><strong>$ cd newEleventySite\/<\/strong><\/pre>\n<pre><strong>$ npm init -y<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"545\" height=\"318\" class=\"wp-image-10091\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-276.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-276.png 545w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-276-300x175.png 300w\" sizes=\"auto, (max-width: 545px) 100vw, 545px\" \/><\/strong><\/p>\n<h2>Installing and Creating 11ty Project<\/h2>\n<p><strong> Step 1.<\/strong> Now simply run the following command to create a new directory for your 11ty static site.<\/p>\n<pre><strong>$ npm install --save-dev @11ty\/eleventy<\/strong><\/pre>\n<p>Once done 11ty will be installed in your newly-created directory. It is a per-project installation. I did not choose to install 11ty globally. This makes installation easier and manageable.<\/p>\n<p><strong>Step 2.<\/strong> Now run Eleventy and you will see that some files were written. I don\u2019t have any files so nothing will happen at this stage.<\/p>\n<pre><strong>$ npx @11ty\/eleventy<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"563\" height=\"60\" class=\"wp-image-10092\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-277.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-277.png 563w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-277-300x32.png 300w\" sizes=\"auto, (max-width: 563px) 100vw, 563px\" \/><\/strong><\/p>\n<p>As you can see in the above screen, I ran 11ty successfully. Everything at this stage is working absolutely fine. We have been working so long, and it is time now to create the website and publish it. Before that, we need a template.<\/p>\n<h2>Create a template<\/h2>\n<p><strong>Step 3.<\/strong> Now I will help you to create a template. It is simple and there isn\u2019t anything complex to perform. It is merely a starting point.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"773\" height=\"62\" class=\"wp-image-10093\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-278.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-278.png 773w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-278-300x24.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-278-768x62.png 768w\" sizes=\"auto, (max-width: 773px) 100vw, 773px\" \/><\/p>\n<p>Here is the code:<\/p>\n<pre><strong>$ echo &#039;&lt;!doctype html&gt;&lt;html&gt;&lt;head&gt;&lt;title&gt;Page title&lt;\/title&gt;&lt;\/head&gt;&lt;body&gt;&lt;p&gt;Hi&lt;\/p&gt;&lt;\/body&gt;&lt;\/html&gt;&#039; &gt; index.ht<\/strong>ml<\/pre>\n<pre><strong>$ echo '# Page header' &gt; README.md<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"619\" height=\"92\" class=\"wp-image-10094\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-279.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-279.png 619w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-279-300x45.png 300w\" sizes=\"auto, (max-width: 619px) 100vw, 619px\" \/><\/p>\n<p>Once the template is done, you are good to go to publish your website for the time being. In the above screenshot, you notice that 11ty has successfully written the two pages.<\/p>\n<h2>Publishing the website<\/h2>\n<p>Once templating is done, 11ty saves the site to <strong><em>_site<\/em><\/strong> folder. You can take all exported files and publish them to your host using an FTP client. As shown in the screenshot below, I appended the &#8211;serve command in the end to publish the website.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"631\" height=\"227\" class=\"wp-image-10095\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-280.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-280.png 631w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-280-300x108.png 300w\" sizes=\"auto, (max-width: 631px) 100vw, 631px\" \/><\/p>\n<p>Here is how it looks in the browser.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"748\" height=\"306\" class=\"wp-image-10096\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-281.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-281.png 748w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-281-300x123.png 300w\" sizes=\"auto, (max-width: 748px) 100vw, 748px\" \/><\/p>\n<h2>Conclusion<\/h2>\n<p>In this tutorial, I guided you on how to install Eleventy, which is a nice static site generator powered by NodeJS. This guide is for Ubuntu 20.04 users. I constantly write articles for different distributions. I invite you to read and share them with your friends and family.<\/p>","protected":false},"excerpt":{"rendered":"<p>Introduction 11ty is a NodeJS-based powerful static site generator. In this tutorial, I will walk you through step by step and show you how to install 11ty on&hellip;<\/p>","protected":false},"author":1,"featured_media":10307,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[542,100],"class_list":["post-10090","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-11ty","tag-ubuntu-20-04"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/10090","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=10090"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/10090\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/10307"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=10090"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=10090"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=10090"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}