Skip to main content

Mapping out your Laravel project

Every project has to kick off somewhere.  Yep well that's a no brainer.  However, the number of projects that I've seen where the planning step has been omitted is too high.  A throughly planned out project with as many features scoped before you start coding is critical in completing a project.  Whilst projects and their requirements are always fluid, the initial critical scoping is so important.

Discovering Drupal caches

The cache system in Drupal 9 delivers the API with the elements required for creation, storage and invalidation of cached data.  Drupal is structured so initially data is stored in the database.  Whereas, files are stored in the following directories:

Site logo image is missing width and height

Running a few SEO and performance tests and I discovered that the site logo image tag doesn't contain a width and height variables!

How do you add image width and height to your site logo?

Working on the base that your theme file is a custom theme, then there are two files that you will need to edit:

  • theme file; and 
  • system branding block file

 

Installing Varnish

Installing Varnish to increase the speed of the page load.

Install varnish using the command below

yum install varnish

Your response should look something like

How to exclude the current node from a list view

How do you exclude the current node from a list view?

In some situations, for example a block listing nodes related to the node being viewed, you might wish to exclude the current node from a list view.

Steps:

Creating a node alias path in a twig file

Do you want to know how to add a node alias in a twig file?  Rather than do the set up in a custom module or using your theme file.

To be able to create a node alias in a twig file you need to know the node.nid value.  Obviously without it you have nothing to reference from.  In this example, the node.nid value is extracted during a loop.  A fairly standard loop such as

Get the current user or load a user using a uid value

How to get the current user or load a user using a uid value.

$current_user = \Drupal::currentUser();
$user = \Drupal\user\Entity\User::load($current_user->id());

or just use

$user = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id());

An example of this in action

npm dependencies and devDependencies

Currently I'm working through an app that has been abandoned by the developers.  The client was getting no response from the dev company, when they asked if I could have a look.  The app hadn't been updated for 18 months.  So of course, a product that hasn't been updated in that timeframe is going to have a suite of npm update issues / conflicts.

 

ionic app that hasn't been updated for a while - what did I do?

I recently received an ionic app that hasn't been updated for quite some time.  What steps did I do to unpack this situation and as a minimum get the packages updated?

To start, I did a quick check on the number of packages missing or outdated can be discovered through using the command:

npm outdated

Reponse from command:

Subscribe to