<?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: Aya Ayari</title>
    <description>The latest articles on DEV Community by Aya Ayari (@yayaritacode).</description>
    <link>https://dev.to/yayaritacode</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%2F290361%2F2e73d53b-715c-4e63-b3d3-b7105455bedb.jpg</url>
      <title>DEV Community: Aya Ayari</title>
      <link>https://dev.to/yayaritacode</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yayaritacode"/>
    <language>en</language>
    <item>
      <title>SEO  (Frontend best practices part II)</title>
      <dc:creator>Aya Ayari</dc:creator>
      <pubDate>Fri, 18 Dec 2020 20:13:49 +0000</pubDate>
      <link>https://dev.to/yayaritacode/seo-frontend-best-practices-part-ii-234k</link>
      <guid>https://dev.to/yayaritacode/seo-frontend-best-practices-part-ii-234k</guid>
      <description>&lt;p&gt;You can find the first part of this article in here &lt;a href="https://t.co/CQDtblUG7A?amp=1"&gt;Frontend best practices (part I) &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Search Engine Optimization&lt;/strong&gt; aka SEO as mentioned by Google is  " the practice of increasing the quantity and quality of traffic to your website through organic search engine results"&lt;/p&gt;

&lt;p&gt;Here are the most important rules to follow to improve your website traffic:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Make sure you have a &lt;strong&gt;title&lt;/strong&gt; tag per page&lt;/li&gt;
&lt;li&gt;Make sure you have &lt;strong&gt;meta-description&lt;/strong&gt; per page and do not 
use quotes or any non-alpha characters&lt;/li&gt;
&lt;li&gt;Exactly one &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; tag per page&lt;/li&gt;
&lt;li&gt;Make sure every image have alt tag( use dashes (-) and do 
not use non-alpha characters) &lt;/li&gt;
&lt;li&gt;Use internal linking like breadcrumbs&lt;/li&gt;
&lt;li&gt;Choose a good URL structure (short, meaningful and without stop words like "the" "a" )&lt;/li&gt;
&lt;li&gt;Use more backlinks&lt;/li&gt;
&lt;li&gt;Improve page performance (exp: use lazy loading for pictures, consider the best image format ...)&lt;/li&gt;
&lt;li&gt;Mobile friendly pages&lt;/li&gt;
&lt;li&gt;Consider the website architecture
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                    Home page
                        |
           ———————————————————————————————         
           |            |                 |
    IT courses    language courses       mathematics courses

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Part III will be about Accessibility&lt;/p&gt;

</description>
      <category>fontend</category>
    </item>
    <item>
      <title>Frontend best practices (Part I)</title>
      <dc:creator>Aya Ayari</dc:creator>
      <pubDate>Sat, 12 Dec 2020 19:41:08 +0000</pubDate>
      <link>https://dev.to/yayaritacode/frontend-best-practices-3kho</link>
      <guid>https://dev.to/yayaritacode/frontend-best-practices-3kho</guid>
      <description>&lt;p&gt;In this post, I will try to summarize some of the tips my team and i were using to write a quality code:&lt;/p&gt;

&lt;h1&gt;
  
  
  Naming
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;When trying to name your variables or your components try always to make &lt;strong&gt;the name describe the purpose&lt;/strong&gt; of the variable or function or component. &lt;br&gt;
&lt;strong&gt;Rule:&lt;/strong&gt; If you need a comment to describe the purpose of variable/function/component most probably you didn't use an adequate name for your variables.&lt;br&gt;
It's okey if the name is long as far as it still making the purpose clear.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;One more thing you need to consider when choosing names is &lt;strong&gt;consistency&lt;/strong&gt;. &lt;br&gt;
Assuming that you are creating a file &lt;code&gt;Registration.js&lt;/code&gt; the styles of this file should be in &lt;code&gt;registration.scss&lt;/code&gt; and if you have more files related to registration like &lt;code&gt;RegistrationCTA.js&lt;/code&gt; as separate component for the call to action button you can use a folder called Registration to put all files together.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Styling:
&lt;/h1&gt;

&lt;h2&gt;
  
  
  1. Mobile first:
&lt;/h2&gt;

&lt;p&gt;When trying to style your page, it is recommended to start by designing the mobile first then use media queries to design tablets and desktop.&lt;br&gt;
This rule creates consistency between all your styles and all the team working on separate pages or other parts of the page. In addition it makes media queries simpler to understand for developers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.registration-form__image {
  padding: __px-to-rem(40);
  margin: 0 __px-to-rem(20);

  @media (min-width: $tablet-breakpoint) {
    padding: __px-to-rem(80) __px-to-rem(40) 0;
  }
  @media (min-width: $desktop-breakpoint) {
    margin: 0 __px-to-rem(129);
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Common files:
&lt;/h2&gt;

&lt;p&gt;When working on a project and you have recurrence of some values across files like colors, variables of media queries and mixins in this case it's recommended to create a common folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;common
   |
   |__colors.scss
   |__queries.scss
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;his will help ensure consistency across project.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. BEM naming:
&lt;/h2&gt;

&lt;p&gt;Like any other rules that has a purpose to keep consistency in the project especially if there is a big team working on it they need  to name Class Names using a standardized naming convention. For that you can use &lt;a href="http://getbem.com/naming/"&gt;BEM&lt;/a&gt; to name all CSS classes.&lt;br&gt;
CSS class is taking this format &lt;br&gt;
                 &lt;code&gt;block__element--modifier&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Block&lt;/strong&gt;&lt;br&gt;
Standalone entity that is meaningful on its own.&lt;br&gt;
form header footer section container menu &lt;br&gt;
&lt;strong&gt;Element&lt;/strong&gt;&lt;br&gt;
A part of a block that has no standalone meaning and is semantically tied to its block.&lt;br&gt;
title item list checkbox caption &lt;br&gt;
&lt;strong&gt;Modifier&lt;/strong&gt;&lt;br&gt;
A flag on a block or element. Use them to change behavior or appearance.&lt;br&gt;
color disabled highlighted checked&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.form { }
.form--theme-xmas { }
.form--simple { }
.form__input { }
.form__submit { }
.form__submit--disabled { }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: They better appear in css files in same order they are in your component.&lt;/p&gt;

&lt;h1&gt;
  
  
  Consider SEO and Accessibility
&lt;/h1&gt;

&lt;p&gt;In next articles I will talk about both of them&lt;/p&gt;

</description>
      <category>frontend</category>
    </item>
    <item>
      <title>Getting Started with Gatsby</title>
      <dc:creator>Aya Ayari</dc:creator>
      <pubDate>Fri, 16 Oct 2020 05:24:07 +0000</pubDate>
      <link>https://dev.to/yayaritacode/getting-started-with-gatsby-4cm8</link>
      <guid>https://dev.to/yayaritacode/getting-started-with-gatsby-4cm8</guid>
      <description>&lt;p&gt;Gatsby is &lt;strong&gt;react-based&lt;/strong&gt; open source framework and fast static websites generator. It allows to create static HTML at build time and gives the browser a complete page. &lt;br&gt;
Gatsby uses &lt;strong&gt;preload&lt;/strong&gt; to speed up loading of resources required by the page: all the necessary CSS , data and its core JavaScript needed to run the page and starts prefetching all links on the page. Also uses &lt;strong&gt;code splitting&lt;/strong&gt; during compilation in a way that WEBPACK imports the dependencies on separate bundles. &lt;/p&gt;
&lt;h1&gt;
  
  
  Gatsby vs NextJs vs create-react-app
&lt;/h1&gt;

&lt;p&gt;The choice of the framework depends on the project itself. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Gatsby&lt;/strong&gt;: Static HTML and can be used when you need good SEO and you don't have frequent data updates&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NextJs&lt;/strong&gt;: Server Side rendering if you need good SEO and data is updating frequently exp: facebook&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CRA&lt;/strong&gt;: Client side rendering when you don't need good SEO exp: private dashboards&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;
  
  
  Getting Started on Gatsby:
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;Install Global CLI:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -g gatsby-cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Create new Site:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gatsby new my-gatsby-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Start development server:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gatsby develop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h1&gt;
  
  
  Gatsby project Structure
&lt;/h1&gt;

&lt;p&gt;Once you create you Gatsby application you will find this structure of the project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;|-- /.cache
|-- /plugins
|-- /public
|-- /src
    |-- /pages
    |-- /templates
    |-- html.js
|-- /static
|-- gatsby-config.js
|-- gatsby-node.js
|-- gatsby-ssr.js
|-- gatsby-browser.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;src folder&lt;/strong&gt;: This directory will contain all of the code related to what you will see on the frontend of your site (what you see in the browser), like your site header, or a page template. “Src” is a convention for “source code”.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;pages&lt;/strong&gt;: become pages automatically with paths based on their file name&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;templates&lt;/strong&gt;: Contains templates for programmatically creating pages. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;html&lt;/strong&gt;: need to be modified if you want to insert custom HTML into the  or  of each page on your site&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;static&lt;/strong&gt;: it will not be processed by webpack.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;gatsby-config.js&lt;/strong&gt;:  This is the main configuration file for a Gatsby site. This is where you can specify information about your site (metadata) like the site title and description, which Gatsby plugins you’d like to include, etc.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;gatsby-node.js&lt;/strong&gt;: This file is where Gatsby expects to find any usage of the Gatsby node APIs (if any). These allow customization/extension of default Gatsby settings affecting pieces of the site build process.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;gatsby-ssr.js&lt;/strong&gt;: This file is where Gatsby expects to find any usage of the Gatsby server-side rendering APIs (if any). These allow customization of default Gatsby settings affecting server-side rendering.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;gatsby-browser.js&lt;/strong&gt;: This file is where Gatsby expects to find any usage of the Gatsby browser APIs (if any). These allow customization/extension of default Gatsby settings affecting the browser.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Gatsby’s data layer is powered by GraphQL and it allows you pull data into your components &lt;/p&gt;

</description>
      <category>gatsby</category>
      <category>javascript</category>
      <category>typescript</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
