Sunday, October 11, 2020

What are core web vitals that affect Ranking - Part 2

How to use Core Web Vitals for your SEO


While the initial reaction to a new Google ranking factor might be annoyance, trepidation or frustration, tracking your site’s Core Web Vitals can help your SEO efforts quite a bit.


If you’ve been working in the SEO world for almost any amount of time you’ve probably noticed that Google constantly "advises" to site owners to provide their users with a “great experience” but didn’t really expound on what that might mean.



Google Search Console Core Web Vitals


Google recently replaced the Speed Report in Google Search Console with the new Web Core Vitals report.


his provides an overview of how all of your web pages perform against the new metrics, categorizing them as either red, for ‘poor URLs’, orange, for ‘URLs need improvement’, and green, for ‘good URLs’.




This is segmented by device, showing both Mobile and Desktop results. Users can then click the ‘Open Report’ link to see a breakdown of each error type, with additional information and sample URLs.



Core Web Vitals vs. other ranking factors

While providing your users with a great page experience is important for SEO, it’s not the be-all, end-all when it comes to rankings. Google is still looking at other signals such as trust factors, content quality and relevance.


These factors related to overall information quality are still considered to be the primary elements that go into determining search rankings. Core Web Vitals will serve in more of a "tie-breaker" role when two pages have content of relatively equal relevance and quality.


This means a page with poorer Core Web Vital scores could still outrank those with better page experiences on the back of better, more relevant content.





Core WebVital testing tools

Tracking Your Site’s Core Web Vitals

There are several ways to track the Core Web Vital metrics for your website:


Your site’s Google Search Console account

https://search.google.com/search-console


Google’s PageSpeed Insights tool

https://developers.google.com/speed/pagespeed/insights/


Lighthouse

https://developers.google.com/web/tools/lighthouse#devtools


Web Vitals Chrome extension

https://chrome.google.com/webstore/detail/web-vitals/ahfhijdlegdabablpippeagghigmibma


Chrome DevTools


Chrome UX Report

https://developers.google.com/web/tools/chrome-user-experience-report


Google has also created an open-source web-vitals JavaScript library so site owners and third-party analytics providers can create their own tracking solutions.


References:

https://www.woorank.com/en/blog/google-core-web-vitals

What are core web vitals that affect Ranking - Part 1

Back in early May, Google introduced Core Web Vitals, a set of metrics designed to measure the quality of a website’s user experience. These metrics are related to page load time, interactivity and stability.


Now, Google has announced that they will combine Core Web Vitals with other factors such as mobile-friendliness, website security and the presence of intrusive interstitials to create a comprehensive evaluation of a page’s user experience.


This evaluation will also be incorporated into Google’s search algorithm, meaning Core Web Vitals will be used as a ranking factor.


What are Core Web Vitals?


According to Google, Core Web Vitals "measure dimensions of web usability such as load time, interactivity, and the stability of content as it loads (so you don’t accidentally tap that button when it shifts under your finger - how annoying!)."


Core Web Vitals are made up of 3 metrics:

Largest Contentful Paint (LCP) measures how long it takes a page to load and display the main page content. Aim for an LCP of 2.5 seconds or faster.


First Input Delay (FID) measures how long a user has to wait to interact with a page. A "good" FID is 100 milliseconds or less.



Cumulative Layout Shift (CLS) is the evaluation of how stable a page is as it loads. It measures how much the layout of a page shifts as it loads. Ideally, a page’s CLS should be no more than 0.1.


It’s worth noting, however, that the metrics scored in Core Web Vitals can shift and change as the web evolves. In fact, Google has said they anticipate incorporating more page experience factors into their ranking factors on a "yearly basis" as user expectations change.


How to use Core Web Vitals for your SEO


While the initial reaction to a new Google ranking factor might be annoyance, trepidation or frustration, tracking your site’s Core Web Vitals can help your SEO efforts quite a bit.


If you’ve been working in the SEO world for almost any amount of time you’ve probably noticed that Google constantly "advises" to site owners to provide their users with a “great experience” but didn’t really expound on what that might mean.


Well, now you have actual hard data you can track and analyze to ensure that you are, indeed providing users with a positive page experience.


Google Search Console Core Web Vitals


Google recently replaced the Speed Report in Google Search Console with the new Web Core Vitals report. This provides an overview of how all of your web pages perform against the new metrics, categorizing them as either red, for ‘poor URLs’, orange, for ‘URLs need improvement’, and green, for ‘good URLs’.


References

https://www.woorank.com/en/blog/google-core-web-vitals


What is WebPack

webpack is used to compile JavaScript modules. Once installed, you can interface with webpack either from its CLI or API. 


Basic Setup

First let's create a directory, initialize npm, install webpack locally, and install the webpack-cli (the tool used to run webpack on the command line):


mkdir webpack-demo

cd webpack-demo

npm init -y

npm install webpack webpack-cli --save-dev



Now we'll create the following directory structure, files and their contents:


project


  webpack-demo

  |- package.json

 |- index.html

 |- /src

   |- index.js


src/index.js


function component() {

  const element = document.createElement('div');


  // Lodash, currently included via a script, is required for this line to work

  element.innerHTML = _.join(['Hello', 'webpack'], ' ');


  return element;

}


document.body.appendChild(component());


index.html


<!doctype html>

<html>

  <head>

    <title>Getting Started</title>

    <script src="https://unpkg.com/lodash@4.16.6"></script>

  </head>

  <body>

    <script src="./src/index.js"></script>

  </body>

</html>


We also need to adjust our package.json file in order to make sure we mark our package as private, as well as removing the main entry. This is to prevent an accidental publish of your code.


package.json


  {

    "name": "webpack-demo",

    "version": "1.0.0",

    "description": "",

   "private": true,

   "main": "index.js",

    "scripts": {

      "test": "echo \"Error: no test specified\" && exit 1"

    },

    "keywords": [],

    "author": "",

    "license": "ISC",

    "devDependencies": {

      "webpack": "^4.20.2",

      "webpack-cli": "^3.1.2"

    },

    "dependencies": {}

  }


In this example, there are implicit dependencies between the <script> tags. Our index.js file depends on lodash being included in the page before it runs. This is because index.js never explicitly declared a need for lodash; it just assumes that the global variable _ exists.


There are problems with managing JavaScript projects this way:


It is not immediately apparent that the script depends on an external library.

If a dependency is missing, or included in the wrong order, the application will not function properly.

If a dependency is included but not used, the browser will be forced to download unnecessary code.

Let's use webpack to manage these scripts instead.




Creating a Bundle

First we'll tweak our directory structure slightly, separating the "source" code (/src) from our "distribution" code (/dist). The "source" code is the code that we'll write and edit. The "distribution" code is the minimized and optimized output of our build process that will eventually be loaded in the browser. Tweak the directory structure as follows:




project


  webpack-demo

  |- package.json

 |- /dist

   |- index.html

 |- index.html

  |- /src

    |- index.js


To bundle the lodash dependency with index.js, we'll need to install the library locally:


npm install --save lodash




References:

https://webpack.js.org/guides/getting-started/

Why Lodash?

Lodash makes JavaScript easier by taking the hassle out of working with arrays, numbers, objects, strings, etc.

Lodash’s modular methods are great for:

Iterating arrays, objects, & strings

Manipulating & testing values

Creating composite functions

Module Formats

Lodash is available in a variety of builds & module formats.

lodash & per method packages

lodash-es, babel-plugin-lodash, & lodash-webpack-plugin

lodash/fp

lodash-amd


Lodash is a JavaScript library which provides utility functions for common programming tasks. It uses functional programming paradigm. Lodash was inspired by Underscore.js.


Lodash helps programmers write more concise and easier to maintain JavaScript code. Lodash contains tools to simplify programming with strings, numbers, arrays, functions and objects.

References:

https://lodash.com/


pip vs. conda

 pip installs python packages in any environment.

conda installs any package in conda environments.


If you already have a Python installation that you're using, then the choice of which to use is easy:


If you installed Python using Anaconda or Miniconda, then use conda to install Python packages. If conda tells you the package you want doesn't exist, then use pip (or try conda-forge, which has more packages available than the default conda channel).


If you installed Python any other way (from source, using pyenv, virtualenv, etc.), then use pip to install Python packages


Finally, because it often comes up, I should mention that you should never use sudo pip install.


NEVER.


It will always lead to problems in the long term, even if it seems to solve them in the short-term. For example, if pip install gives you a permission error, it likely means you're trying to install/update packages in a system python, such as /usr/bin/python. Doing this can have bad consequences, as often the operating system itself depends on particular versions of packages within that Python installation. For day-to-day Python usage, you should isolate your packages from the system Python, using either virtual environments or Anaconda/Miniconda — I personally prefer conda for this, but I know many colleagues who prefer virtualenv.


references:

https://jakevdp.github.io/blog/2017/12/05/installing-python-packages-from-jupyter/

Saturday, October 10, 2020

Linux How to remove all files starting with a name

To delete all files which name has name, you can use it:


find  . -name 'name*' -exec rm {} \;


References:

https://superuser.com/questions/482435/how-to-remove-all-files-starting-with-a-certain-string-in-linux/482436