Gatsby Headaches: Working With Media (Part 1)

October 9th, 2023 No comments

Working with media files in Gatsby might not be as straightforward as expected. I remember starting my first Gatsby project. After consulting Gatsby’s documentation, I discovered I needed to use the gatsby-source-filesystem plugin to make queries for local files. Easy enough!

That’s where things started getting complicated. Need to use images? Check the docs and install one — or more! — of the many, many plugins available for handling images. How about working with SVG files? There is another plugin for that. Video files? You get the idea.

It’s all great until any of those plugins or packages become outdated and go unmaintained. That’s where the headaches start.

If you are unfamiliar with Gatsby, it’s a React-based static site generator that uses GraphQL to pull structured data from various sources and uses webpack to bundle a project so it can then be deployed and served as static files. It’s essentially a static site generator with reactivity that can pull data from a vast array of sources.

Like many static site frameworks in the Jamstack, Gatsby has traditionally enjoyed a great reputation as a performant framework, although it has taken a hit in recent years. Based on what I’ve seen, however, it’s not so much that the framework is fast or slow but how the framework is configured to handle many of the sorts of things that impact performance, including media files.

So, let’s solve the headaches you might encounter when working with media files in a Gatsby project. This article is the first of a brief two-part series where we will look specifically at the media you are most likely to use: images, video, and audio. After that, the second part of this series will get into different types of files, including Markdown, PDFs, and even 3D models.

Solving Image Headaches In Gatsby

I think that the process of optimizing images can fall into four different buckets:

  1. Optimize image files.
    Minimizing an image’s file size without losing quality directly leads to shorter fetching times. This can be done manually or during a build process. It’s also possible to use a service, like Cloudinary, to handle the work on demand.
  2. Prioritize images that are part of the First Contentful Paint (FCP).
    FCP is a metric that measures the time between the point when a page starts loading to when the first bytes of content are rendered. The idea is that fetching assets that are part of that initial render earlier results in faster loading rather than waiting for other assets lower on the chain.
  3. Lazy loading other images.
    We can prevent the rest of the images from render-blocking other assets using the loading="lazy" attribute on images.
  4. Load the right image file for the right context.
    With responsive images, we can serve one version of an image file at one screen size and serve another image at a different screen size with the srcset and sizes attributes or with the element.

These are great principles for any website, not only those built with Gatsby. But how we build them into a Gatsby-powered site can be confusing, which is why I’m writing this article and perhaps why you’re reading it.

Lazy Loading Images In Gatsby

We can apply an image to a React component in a Gatsby site like this:

import * as React from "react";

import forest from "./assets/images/forest.jpg";

const ImageHTML = () => {
  return <img src={ forest } alt="Forest trail" />;
};

It’s important to import the image as a JavaScript module. This lets webpack know to bundle the image and generate a path to its location in the public folder.

This works fine, but when are we ever working with only one image? What if we want to make an image gallery that contains 100 images? If we try to load that many tags at once, they will certainly slow things down and could affect the FCP. That’s where the third principle that uses the loading="lazy" attribute can come into play.

import * as React from "react";

import forest from "./assets/images/forest.jpg";

const LazyImageHTML = () => {
  return <img src={ forest } loading="lazy" alt="Forest trail" />;
};

We can do the opposite with loading="eager". It instructs the browser to load the image as soon as possible, regardless of whether it is onscreen or not.

import * as React from "react";

import forest from "./assets/images/forest.jpg";

const EagerImageHTML = () => {
  return <img src={ forest } loading="eager" alt="Forest trail" />;
};

Implementing Responsive Images In Gatsby

This is a basic example of the HTML for responsive images:

<img
  srcset="./assets/images/forest-400.jpg 400w, ./assets/images/forest-800.jpg 800w"
  sizes="(max-width: 500px) 400px, 800px"
  alt="Forest trail"
/>

In Gatsby, we must import the images first and pass them to the srcset attribute as template literals so webpack can bundle them:

import * as React from "react";

import forest800 from "./assets/images/forest-800.jpg";

import forest400 from "./assets/images/forest-400.jpg";

const ResponsiveImageHTML = () => {
  return (
    <img
      srcSet={`

        ${ forest400 } 400w,

        ${ forest800 } 800w

      `}
      sizes="(max-width: 500px) 400px, 800px"
      alt="Forest trail"
    />
  );
};

That should take care of any responsive image headaches in the future.

Loading Background Images In Gatsby

What about pulling in the URL for an image file to use on the CSS background-url property? That looks something like this:

import * as React from "react";

import "./style.css";

const ImageBackground = () => {
  return <div className="banner"></div>;
};
/* style.css */

.banner {
      aspect-ratio: 16/9;
      background-size: cover;

    background-image: url("./assets/images/forest-800.jpg");

  /* etc. */
}

This is straightforward, but there is still room for optimization! For example, we can do the CSS version of responsive images, which loads the version we want at specific breakpoints.

/* style.css */

@media (max-width: 500px) {
  .banner {
    background-image: url("./assets/images/forest-400.jpg");
  }
}

Using The gatsby-source-filesystem Plugin

Before going any further, I think it is worth installing the gatsby-source-filesystem plugin. It’s an essential part of any Gatsby project because it allows us to query data from various directories in the local filesystem, making it simpler to fetch assets, like a folder of optimized images.

npm i gatsby-source-filesystem

We can add it to our gatsby-config.js file and specify the directory from which we will query our media assets:

// gatsby-config.js

module.exports = {
  plugins: [
    {
      resolve: `gatsby-source-filesystem`,

      options: {
        name: `assets`,

        path: `${ __dirname }/src/assets`,
      },
    },
  ],
};

Remember to restart your development server to see changes from the gatsby-config.js file.

Now that we have gatsby-source-filesystem installed, we can continue solving a few other image-related headaches. For example, the next plugin we look at is capable of simplifying the cures we used for lazy loading and responsive images.

Using The gatsby-plugin-image Plugin

The gatsby-plugin-image plugin (not to be confused with the outdated gatsby-image plugin) uses techniques that automatically handle various aspects of image optimization, such as lazy loading, responsive sizing, and even generating optimized image formats for modern browsers.

Once installed, we can replace standard tags with either the or components, depending on the use case. These components take advantage of the plugin’s features and use the HTML element to ensure the most appropriate image is served to each user based on their device and network conditions.

We can start by installing gatsby-plugin-image and the other plugins it depends on:

npm install gatsby-plugin-image gatsby-plugin-sharp gatsby-transformer-sharp

Let’s add them to the gatsby-config.js file:

// gatsby-config.js

module.exports = {
plugins: [

// other plugins
`gatsby-plugin-image`,
`gatsby-plugin-sharp`,
`gatsby-transformer-sharp`],

};

This provides us with some features we will put to use a bit later.

Using The StaticImage Component

The StaticImage component serves images that don’t require dynamic sourcing or complex transformations. It’s particularly useful for scenarios where you have a fixed image source that doesn’t change based on user interactions or content updates, like logos, icons, or other static images that remain consistent.

The main attributes we will take into consideration are:

  • src: This attribute is required and should be set to the path of the image you want to display.
  • alt: Provides alternative text for the image.
  • placeholder: This attribute can be set to either blurred or dominantColor to define the type of placeholder to display while the image is loading.
  • layout: This defines how the image should be displayed. It can be set to fixed for, as you might imagine, images with a fixed size, fullWidth for images that span the entire container, and constrained for images scaled down to fit their container.
  • loading: This determines when the image should start loading while also supporting the eager and lazy options.

Using StaticImage is similar to using a regular HTML tag. However, StaticImage requires passing the string directly to the src attribute so it can be bundled by webpack.

import * as React from "react";

import { StaticImage } from "gatsby-plugin-image";

const ImageStaticGatsby = () => {
  return (
    <StaticImage
      src="./assets/images/forest.jpg"
      placeholder="blurred"
      layout="constrained"
      alt="Forest trail"
      loading="lazy"
    />
  );
  };

The StaticImage component is great, but you have to take its constraints into account:

  • No Dynamically Loading URLs
    One of the most significant limitations is that the StaticImage component doesn’t support dynamically loading images based on URLs fetched from data sources or APIs.
  • Compile-Time Image Handling
    The StaticImage component’s image handling occurs at compile time. This means that the images you specify are processed and optimized when the Gatsby site is built. Consequently, if you have images that need to change frequently based on user interactions or updates, the static nature of this component might not fit your needs.
  • Limited Transformation Options
    Unlike the more versatile GatsbyImage component, the StaticImage component provides fewer transformation options, e.g., there is no way to apply complex transformations like cropping, resizing, or adjusting image quality directly within the component. You may want to consider alternative solutions if you require advanced transformations.

Using The GatsbyImage Component

The GatsbyImage component is a more versatile solution that addresses the limitations of the StaticImage component. It’s particularly useful for scenarios involving dynamic image loading, complex transformations, and advanced customization.

Some ideal use cases where GatsbyImage is particularly useful include:

  • Dynamic Image Loading
    If you need to load images dynamically based on data from APIs, content management systems, or other sources, the GatsbyImage component is the go-to choice. It can fetch images and optimize their loading behavior.
  • Complex transformations
    The GatsbyImage component is well-suited for advanced transformations, using GraphQL queries to apply them.
  • Responsive images
    For responsive design, the GatsbyImage component excels by automatically generating multiple sizes and formats of an image, ensuring that users receive an appropriate image based on their device and network conditions.

Unlike the StaticImage component, which uses a src attribute, GatsbyImage has an image attribute that takes a gatsbyImageData object. gatsbyImageData contains the image information and can be queried from GraphQL using the following query.

query {
  file(name: { eq: "forest" }) {
    childImageSharp {
      gatsbyImageData(width: 800, placeholder: BLURRED, layout: CONSTRAINED)
    }

    name
  }
}

If you’re following along, you can look around your Gatsby data layer at http://localhost:8000/___graphql.

From here, we can use the useStaticQuery hook and the graphql tag to fetch data from the data layer:

import * as React from "react";

import { useStaticQuery, graphql } from "gatsby";

import { GatsbyImage, getImage } from "gatsby-plugin-image";

const ImageGatsby = () => {
  // Query data here:

  const data = useStaticQue(graphql``);

  return <div></div>;
};

Next, we can write the GraphQL query inside of the graphql tag:

import * as React from "react";

import { useStaticQuery, graphql } from "gatsby";

const ImageGatsby = () => {
  const data = useStaticQuery(graphqlquery {
      file(name: { eq: "forest" }) {
        childImageSharp {
          gatsbyImageData(width: 800, placeholder: BLURRED, layout: CONSTRAINED)
        }

        name
      }
    });

  return <div></div>;
};

Next, we import the GatsbyImage component from gatsby-plugin-image and assign the image’s gatsbyImageData property to the image attribute:

import * as React from "react";

import { useStaticQuery, graphql } from "gatsby";

import { GatsbyImage } from "gatsby-plugin-image";

const ImageGatsby = () => {
  const data = useStaticQuery(graphqlquery {
      file(name: { eq: "forest" }) {
        childImageSharp {
          gatsbyImageData(width: 800, placeholder: BLURRED, layout: CONSTRAINED)
        }

        name
      }
    });

  return <GatsbyImage image={ data.file.childImageSharp.gatsbyImageData } alt={ data.file.name } />;
};

Now, we can use the getImage helper function to make the code easier to read. When given a File object, the function returns the file.childImageSharp.gatsbyImageData property, which can be passed directly to the GatsbyImage component.

import * as React from "react";

import { useStaticQuery, graphql } from "gatsby";

import { GatsbyImage, getImage } from "gatsby-plugin-image";

const ImageGatsby = () => {
  const data = useStaticQuery(graphqlquery {
      file(name: { eq: "forest" }) {
        childImageSharp {
          gatsbyImageData(width: 800, placeholder: BLURRED, layout: CONSTRAINED)
        }

        name
      }
    });

  const image = getImage(data.file);

  return <GatsbyImage image={ image } alt={ data.file.name } />;
};

Using The gatsby-background-image Plugin

Another plugin we could use to take advantage of Gatsby’s image optimization capabilities is the gatsby-background-image plugin. However, I do not recommend using this plugin since it is outdated and prone to compatibility issues. Instead, Gatsby suggests using gatsby-plugin-image when working with the latest Gatsby version 3 and above.

If this compatibility doesn’t represent a significant problem for your project, you can refer to the plugin’s documentation for specific instructions and use it in place of the CSS background-url usage I described earlier.

Solving Video And Audio Headaches In Gatsby

Working with videos and audio can be a bit of a mess in Gatsby since it lacks plugins for sourcing and optimizing these types of files. In fact, Gatsby’s documentation doesn’t name or recommend any official plugins we can turn to.

That means we will have to use vanilla methods for videos and audio in Gatsby.

Using The HTML video Element

The HTML video element is capable of serving different versions of the same video using the tag, much like the img element uses the srset attribute to do the same for responsive images.

That allows us to not only serve a more performant video format but also to provide a fallback video for older browsers that may not support the bleeding edge:

import * as React from "react";

import natureMP4 from "./assets/videos/nature.mp4";

import natureWEBM from "./assets/videos/nature.webm";

const VideoHTML = () => {
  return (
    <video controls>
      <source src={ natureMP4 } type="video/mp4" />

      <source src={ natureWEBM } type="video/webm" />
    </video>
  );
};

P;

We can also apply lazy loading to videos like we do for images. While videos do not support the loading="lazy" attribute, there is a preload attribute that is similar in nature. When set to none, the attribute instructs the browser to load a video and its metadata only when the user interacts with it. In other words, it’s lazy-loaded until the user taps or clicks the video.

We can also set the attribute to metadata if we want the video’s details, such as its duration and file size, fetched right away.

<video controls preload="none">
  <source src={ natureMP4 } type="video/mp4" />

  <source src={ natureWEBM } type="video/webm" />
</video>

Note: I personally do not recommend using the autoplay attribute since it is disruptive and disregards the preload attribute, causing the video to load right away.

And, like images, display a placeholder image for a video while it is loading with the poster attribute pointing to an image file.

<video controls preload="none" poster={ forest }>
  <source src={ natureMP4 } type="video/mp4" />

  <source src={ natureWEBM } type="video/webm" />
</video>

Using The HTML audio Element

The audio and video elements behave similarly, so adding an audio element in Gatsby looks nearly identical, aside from the element:

import * as React from "react";

import audioSampleMP3 from "./assets/audio/sample.mp3";

import audioSampleWAV from "./assets/audio/sample.wav";

const AudioHTML = () => {
  return (
    <audio controls>
      <source src={ audioSampleMP3 } type="audio/mp3" />

      <source src={ audioSampleWAV } type="audio/wav" />
    </audio>
  );
};

As you might expect, the audio element also supports the preload attribute:

<audio controls preload="none">
  <source src={ audioSampleMP3 } type="audio/mp3" />

  <source src={a udioSampleWAV } type="audio/wav" />
</audio>

This is probably as good as we can do to use videos and images in Gatsby with performance in mind, aside from saving and compressing the files as best we can before serving them.

Solving iFrame Headaches In Gatsby

Speaking of video, what about ones embedded in an like we might do with a video from YouTube, Vimeo, or some other third party? Those can certainly lead to performance headaches, but it’s not as we have direct control over the video file and where it is served.

Not all is lost because the HTML iframe element supports lazy loading the same way that images do.

import * as React from "react";

const VideoIframe = () => {
  return (
    <iframe
      src="https://www.youtube.com/embed/jNQXAC9IVRw"
      title="Me at the Zoo"
      allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
      allowFullScreen
      loading="lazy"
    />
  );
};

Embedding a third-party video player via iframe can possibly be an easier path than using the HTML video element. iframe elements are cross-platform compatible and could reduce hosting demands if you are working with heavy video files on your own server.

That said, an iframe is essentially a sandbox serving a page from an outside source. They’re not weightless, and we have no control over the code they contain. There are also GDPR considerations when it comes to services (such as YouTube) due to cookies, data privacy, and third-party ads.

Solving SVG Headaches In Gatsby

SVGs contribute to improved page performance in several ways. Their vector nature results in a much smaller file size compared to raster images, and they can be scaled up without compromising quality. And SVGs can be compressed with GZIP, further reducing file sizes.

That said, there are several ways that we can use SVG files. Let’s tackle each one in the contact of Gatsby.

Using Inline SVG

SVGs are essentially lines of code that describe shapes and paths, making them lightweight and highly customizable. Due to their XML-based structure, SVG images can be directly embedded within the HTML tag.

import * as React from "react";



const SVGInline = () => {

  return (

    <svg viewBox="0 0 24 24" fill="#000000">

      <!-- etc. -->

    </svg>

  );

};

Just remember to change certain SVG attributes, such as xmlns:xlink or xlink:href, to JSX attribute spelling, like xmlnsXlink and xlinkHref, respectively.

Using SVG In img Elements

An SVG file can be passed into an img element’s src attribute like any other image file.

import * as React from "react";

import picture from "./assets/svg/picture.svg";

const SVGinImg = () => {
  return <img src={ picture } alt="Picture" />;
};

Loading SVGs inline or as HTML images are the de facto approaches, but there are React and Gatsby plugins capable of simplifying the process, so let’s look at those next.

Inlining SVG With The react-svg Plugin

react-svg provides an efficient way to render SVG images as React components by swapping a ReactSVG component in the DOM with an inline SVG.

Once installing the plugin, import the ReactSVG component and assign the SVG file to the component’s src attribute:

import * as React from "react";

import { ReactSVG } from "react-svg";

import camera from "./assets/svg/camera.svg";

const SVGReact = () => {
  return <ReactSVG src={ camera } />;
};

Using The gatsby-plugin-react-svg Plugin

The gatsby-plugin-react-svg plugin adds svg-react-loader to your Gatsby project’s webpack configuration. The plugin adds a loader to support using SVG files as React components while bundling them as inline SVG.

Once the plugin is installed, add it to the gatsby-config.js file. From there, add a webpack rule inside the plugin configuration to only load SVG files ending with a certain filename, making it easy to split inline SVGs from other assets:

// gatsby-config.js

module.exports = {
  plugins: [
    {
      resolve: "gatsby-plugin-react-svg",

      options: {
        rule: {
          include: /.inline.svg$/,
        },
      },
    },
  ],
};

Now we can import SVG files like any other React component:

import * as React from "react";

import Book from "./assets/svg/book.inline.svg";

const GatsbyPluginReactSVG = () => {
  return <Book />;
};

And just like that, we can use SVGs in our Gatsby pages in several different ways!

Conclusion

Even though I personally love Gatsby, working with media files has given me more than a few headaches.

As a final tip, when needing common features such as images or querying from your local filesystem, go ahead and install the necessary plugins. But when you need a minor feature, try doing it yourself with the methods that are already available to you!

If you have experienced different headaches when working with media in Gatsby or have circumvented them with different approaches than what I’ve covered, please share them! This is a big space, and it’s always helpful to see how others approach similar challenges.

Again, this article is the first of a brief two-part series on curing headaches when working with media files in a Gatsby project. The following article will be about avoiding headaches when working with different media files, including Markdown, PDFs, and 3D models.

Further Reading

Categories: Others Tags:

Re-Creating The Pop-Out Hover Effect With Modern CSS (Part 2)

October 5th, 2023 No comments

The last time we met, I demonstrated how newer CSS features — particularly trigonometric functions — can be leveraged to accomplish a “pop-out” hover effect. This is what we made together:

Even the rotation is possible with clip-path polygon():

We can define the shape with three parameters:

  • The number of spikes (we’ll call this N);
  • The radius of the big circle, illustrated in green (we’ll call this R);
  • The radius of the small circle illustrated in blue (this will be R - d).

For the sake of simplicity, I will define d as a percentage of RR - (R * p) — where p is a number in the range [0 1]. So, in the end, we are left with three variables, N, R, and p.

If you look closely at the shape, you can see it is a series of triangular shapes that are cut out of a large circular shape. That is exactly how we are going to tackle this challenge. We can create triangles with conic-gradient and then cut them out of the circle with the mask-composite property. Getting a circle is pretty easy using border-radius: 50%.

The number of conic gradients is equal to the number of triangles in the pattern. Each gradient can use nearly the same configuration, where the difference between them is how they are rotated. That means the gradient’s code will look something like this:

conic-gradient(from -1*angle at {position}, #000 2*angle, #0000 0);

Thankfully, the position we calculated in the last article is similar enough to the point that we can rely on it here as well:

50% + (50% * (1 - p)) * cos(360deg * i/N)
50% + (50% * (1 - p)) * sin(360deg * i/N)

Again, N is the number of triangles, and p controls the radius of the small circle. R is equal to 50%, so the position can also be expressed like this:

R + (R * (1 - p)) * cos(360deg * i/N)
R + (R * (1 - p)) * sin(360deg * i/N)

We need to resort to some geometry to determine the value of angle. I will skip the boring math for the sake of brevity, but please feel free to leave a comment if you’re interested in the formula, and I will be glad to give you more details.

angle = atan(sin(180deg/N)/(p - 1 + cos(180deg/N)))

Now, we need to loop through all of that as many times as there are triangles in the pattern. So, we will do what we did in the last article and switch from vanilla CSS to Sass so we can take advantage of Sass loops.

The following snippet selects the one element in the HTML, , and loops through the conic gradients for as many triangles we set ($n: 9). The output of that loop is saved as another variable, $m, that is applied to the CSS mask.

$n: 9;  /* number of spikes */

img {
--r: 160px; /* radius */ --p: 0.25; /* percent */ --angle: atan(sin(180deg/#{$n}) / (var(--p) - 1 + cos(180deg/#{$n}))); width: calc(2 * var(--r)); aspect-ratio: 1; border-radius: 50%; $m: (); @for $i from 0 through ($n - 1) { $m: append($m, conic-gradient( from calc(90deg + 360deg * #{$i/$n} - var(--angle)) at
calc(50% + (50% * (1 - var(--p))) v cos(360deg * #{$i/$n})) calc(50% + (50% * (1 - var(--p))) * sin(360deg * #{$i/$n})), #000 calc(2*var(--angle)), #0000 0), comma ); } mask: $m; }

Here’s the result of all that work:

Next, we add the scale effect to the image’s :hover state:

img {
  --f: 1.2; /* the scale factor */
  /* etc */
}
img:hover {
  scale: var(--f);
}

To make sure both starburst shapes have identical sizes (in the non-hover and hover states), --i needs a formula based on the scale factor:

img {
  --f: 1.2; /* the scale factor */
  /* etc */
}
img:hover {
  --i: calc(var(--r) * (1 - var(--p)) * (var(--f) - 1) / var(--f));
  scale: var(--f);
}

And, now, we are finally finished.

See the Pen Fancy Pop Out hover effect! by Temani Afif.

Another Example

Let’s try another fancy effect where the avatar is hidden, and on hover, it slides from the bottom to “pop out” while, at the same time, we update the starburst shape.

See the Pen Fancy Pop Out Reveal hover effect! by Temani Afif.

Cool, right? We are still using only one element in the markup, but this time, I introduced the sliding effect. This will be your homework! I will let you dissect the code to understand what I have changed.

Hint: A CSS Tip where I am using the sliding effect.

Wrapping Up

I hope you enjoy having a little extra practice on the techniques we used in the previous article to create this “pop-out” hover effect. If it feels like I went a little faster this time around, it’s because I did. Rather than spending time explaining the same concepts and techniques, I was more concerned with demonstrating them in a slightly different context. So, we learned a few new ideas for working with gradients in CSS masks and background images!

In spite of the complexity of everything we covered, there is nothing that requires you to understand everything at once or even right away. Take the time to go through this and the previous article step-by-step until you grasp the parts that are toughest for you to grok. In all honesty, you will probably never find yourself in a situation where you need to use all these tricks together. This was a pretty niche exercise. But it provides us with an excuse to individually inspect the techniques that can help you solve some complex problems in CSS without resorting to scripting or extra HTML.

As for the math and the formulas, you don’t need to accurately understand them. The goal is to demonstrate that we can be as accurate as we want when it comes to calculating values and still develop something that is incredibly maintainable with only a few variables. Without trigonometric functions and calc() in CSS, we would be obliged to manually set all of the values once we need to update something, which would be incredibly tedious.

I’ll close this little series with a last demo. Enjoy!

See the Pen Pop out hover effect featuring Kevin and Alvaro by Temani Afif.

Categories: Others Tags:

How to Monetize Instagram in 2023

October 4th, 2023 No comments

Instagram isn’t just a platform where people share photos and videos of their daily lives or their adorable pets. 

In 2023, it’s a digital goldmine, a magnet for businesses, marketers, and influencers seeking to capitalize on its over one billion active monthly users. 

Instagram offers an array of ways to monetize and earn a living right from the comfort of your smartphone. But like any goldmine, you have to know where to dig. 

Are you ready to turn those likes and followers into dollars and cents? 

Let’s get started!

Instagram Shoppable Posts 

Instagram Shoppable Posts are a gamechanger in the world of e-commerce. They are essentially Instagram posts but with an added bonus: you get to sell online through Instagram. 

Here’s how they work: the posts include tags on the products featured in the image or the video.

When users tap these tags, they can view product details such as price, description, and more, right within the app. If interested, users can proceed to purchase the product, turning their interest into an instant purchase within a few taps.

Setting up Instagram Shoppable posts is quite simple. You first need to convert your personal Instagram account to a business account. 

Then, connect Instagram to your Facebook catalog. This can be done either through the Facebook Business Manager or Shopify/BigCommerce. 

With your catalog connected, you can then upload an image or video post, and tag the product much like you would a person. 

Once approved by Instagram, these shoppable posts will be shown to your audience, turning a casual scroll into potential profit.

Instagram Shoppable posts blend seamlessly into viewers’ feeds, providing a convenient and effective way to monetize your Instagram. 

The experience is seamless for viewers, making shopping an organic part of their Instagram browsing experience. 

Instagram’s algorithm even helps by showing your shoppable posts to users who exhibit interest in similar products. 

So, while your followers enjoy your content, they can also shop for your products without ever having to leave the platform. 

Sponsored Posts 

Instagram Sponsored Posts are essentially paid advertisements that allow businesses or individuals to reach a larger and more targeted audience. 

These posts can appear as photos, videos, stories, or even as a carousel of multiple images or videos. 

To use Instagram Sponsored Posts effectively: 

  • 1. Ensure your profile is set as a business account to get access to Instagram’s advertising tools. 
  • 2. Next, choose a post on your Instagram that you’d like to promote.
  • 3. Hit the “Boost” button which you will see on this post.
  • 4. Now, you will be asked to define your objective; whether it’s more profile visits, website visits, or even direct messages.
  • 5. The next step involves defining your audience. You can let Instagram suggest an audience based on the people that like your Page or have interacted with you, or you can define a custom audience by choosing specific demographics, locations, and interests.
  • 6. Finally, set your budget and duration. This will determine how long your post will be promoted and the number of people you are likely to reach.

Instagram will then review your promotion and it will be live once approved. 

Instagram Sponsored Posts are a great tool to tap into a global audience, reach your target demographics and extend your brand’s presence

In 2023, they provide one of the most lucrative ways to monetize by increasing exposure to potential customers who are likely interested in what you offer. 

With a bit of strategy and a well-crafted message, sponsored posts can significantly boost your sales and engagement.

Affiliate Marketing 

Affiliate marketing is a modern twist on the age-old practice of commission sales. 

In essence, you’re acting as a trusted intermediary for a product or service, earning a cut every time your followers purchase through your referral link. 

How does it work specifically for Instagram? The key element is your profile’s bio.

Primarily, you partner with a brand that aligns with your Instagram aesthetic and audience. Then, you showcase their product in your post or story, tagging the brand and using an affiliate link. By doing so, you direct your followers to the brand’s website. 

The catch? 

Well, the smarter you are about your brand partnership, the better the payoff. 

Always keep it relevant – if you’re an avid hiker and share your outdoor exploits, partner with an outdoor equipment brand. 

Followers are more likely to buy if it aligns with what brought them to your page in the first place. 

The golden rules? 

Keep it authentic, transparent, and make sure you’re following the FTC guidelines for affiliate marketing. 

If you stick to these, the affiliate marketing world can be a lucrative labyrinth to navigate. 

So, begin today; discover your niche, find your brand, and use that Instagram bio as a portal to profits.

Advertising Pages in Stories and Posts

Advertising pages in stories and posts offer a direct monetization approach on Instagram. Here’s how to leverage them to your advantage:

  • 1. Put effort into creating high-quality, engaging, and branded content. Be it stories or posts, the better your content, the more traffic you’ll attract.
  • 2. Understand who’s following you. Tailor your ads to this demographic to maximize engagement.
  • 3. This step is crucial as it opens Instagram’s monetization features like Branded Content Tools.
  • 4. Create ads by promoting your posts directly or use Facebook’s Ads Manager for more control over your ad campaigns.
  • 5. In your Stories ads, incorporate the ‘Swipe Up’ feature to redirect users to your chosen landing page.
  • 6. Regularly evaluate your ad performance. Instagram provides insights to help track your ads’ engagement and effectiveness.
  • 7. Based on your performance metrics, make necessary adjustments to increase your ad’s visibility and engagement. 

Remember, creativity is your greatest tool when utilizing advertising pages in stories and posts. So be bold, be innovative, and be consistent to build a strong brand image that resonates with your audience.

Wrapping Up

There you have it, Instagram is more than just sharing photos and catching up with friends. With the correct strategies or Instagram tools, it can also become a significant income source. 

As you navigate this often overlooked pathway to monetize Instagram in 2023, remember to keep your personal brand at the forefront of each approach. 

Authenticity speaks louder than promotion, after all.

Featured Image by Claudio Schwarz on Unsplash

The post How to Monetize Instagram in 2023 appeared first on noupe.

Categories: Others Tags:

A Guide to Q4 Ecommerce Marketing Plan

October 4th, 2023 No comments

Q4, the most crucial quarter of the year, is here for e-commerce businesses. The upcoming holiday season in Q4 presents boundless ideal opportunities for e-commerce sellers to boost their transactional momentum. Companies of all sizes can capitalize on the holiday season, achieve extraordinary sales targets, and generate a significant portion of revenue. Black Friday is aptly named so because on Friday after Thanksgiving, businesses saw their profits skyrocket (back) after months-long losses (red). According to Google, 50% of the shopping happens during the holiday season. Insights from Forbes Advisor suggest that e-commerce sales in 2023 are expected to grow at a rate of 10.4%, and the global e-commerce market is expected to reach $6.3 trillion by 2023. So, a Q4 e-commerce marketing plan will make or break the fiscal year for businesses!

Here is an effective e-commerce marketing plan for businesses to nail Q4 and end the year on a profitable note!

Have a solid marketing calendar

As the competition is tough in the e-commerce sector, a marketing calendar in place will let businesses strategically target holidays and grab customers. With a well-organized e-commerce marketing calendar, companies can avoid any last-minute struggle and roll out campaign offers at an apt time on various channels. Keeping key dates in mind, e-commerce businesses can get their assets and inventory ready. Q4 has many special days for e-commerce businesses to plan numerous offers and incentives. They include:

  • Halloween (October 31)
  • Black Friday (November 25)
  • Cyber Monday (November 28)
  • Christmas (December 31)
  • Hanukkah (Dec 18-26)
  • Kwanzaa (December 24-31)
  • Free Shipping Day (December 14)

Evaluate your previous Q4 e-commerce marketing plan

Look back to moving forward! Before formulating the present Q4 e-commerce marketing plan, businesses should assess their previous strategies and zero in on methodologies that worked well for them. They can leverage Google Analytics data from last year to infer which products gave them the highest returns, offers, or deals that brought traffic to their website. Based on the insights, businesses can plan their inventory, restock the bestsellers, and decide the product pricing for best results.

Spend wisely on your marketing budget

Businesses should divide their marketing budget across platforms to get their money’s worth. Before opting for any media for their brand, companies should get accurate data and evaluate the best social channel and display platforms that fit best for their product. Based on the budget allocation, e-commerce businesses can decide the duration and type of campaign they can afford. It is recommended that companies follow the 80-20 rule and spend 80% of their marketing budget on prospecting with cold leads and the remaining 20% on re-targeting. As re-targeting efforts are considered cost-effective, marketing to an audience who visited their website in the last 365 days, social media followers, or consumers who purchased products in the previous six months will be profitable for e-commerce businesses.

Run a quick competitor analysis

Observing competitors will help businesses anticipate new trends and comprehend the shifts in the market. Companies can take up competitor analysis by searching online for names of firms offering similar products to understand the type of audience they are targeting and the offers or incentives they are using to lure customers. By assessing competitors’ strong and weak points, e-commerce businesses can devise the right strategy to benefit them. Companies can attract competitor customers by offering them better deals than their competitors are running and bolstering their sales.

Explore multichannel promotional endeavors

E-commerce businesses should never limit their marketing to single channel as customers never stay loyal to a single channel. Insights from Shopify suggest that companies that take the multichannel marketing route witness 190% higher sales than enterprises that stick to the single–channel approach. Many customers visit various channels to check and compare offers or deals businesses offer. Hence, in the best interest, e-commerce businesses should vigorously promote their products on all possible channels to attract maximum customers and boost their sales productivity. It would be beneficial if companies targeted various age groups of customers like baby boomers, Gen X, millennial, and Gen Z across channels, including billboards, flyers, social media, TV ads, telemarketing, direct mail marketing, and more.

Create compelling product videos

Compelling product videos helps e-commerce businesses gain a competitive edge in the marketplace. It allows them to show the consumers what their product is about, which drives traffic to their website and sales. A video that highlights the product’s benefits and features works wonders attracting potential customers and allows businesses to turn cold leads into hot leads.
E-commerce businesses can also utilize Infomercials to showcase their product’s best features entertainingly and draw consumers’ attention.

Leverage a strong content marketing strategy

An efficient content strategy goes a long way in effectively engaging the customers. Cue content marketing helps businesses tell their audience why their product is best and how it will resolve the pain points affecting them. Today’s consumers are inundated with product promotional communication. If e-commerce businesses need to be heard, their content should be hard-hitting; it should cut through the fluff and convey the product’s nitty–gritty benefits and uses. Unique marketing materials that can be shared on various social platforms, like how-to videos and product guides, can increase product awareness and drive organic website traffic, giving the required push for sales.

Opt for email marketing

Email marketing cannot be ignored in the Q4 quarter. Email marketing provides the perfect platform for e-commerce businesses to easily reach their audience and get a head-start to achieve their sales targets during the holiday season in Q4. Insights from mailcharts suggest that companies across industries have a 13% higher send rate than other quarters of the year. E-commerce businesses can use teaser emails to build anticipation, coupon emails to entice consumers who made purchases in Q4 to buy more next year and retain them, and launch stacked promotions to increase sales via emails. With an effective email marketing funnel, businesses can have more lead conversion, highly benefiting e-commerce enterprise’s sales margins.

Consider upselling

Upselling is vital for e-commerce businesses in Q4 as it improves their revenue by 30%. Enterprises should include upselling in their marketing plan, as selling to existing customers is always easier than selling to new customers. E-commerce businesses can display additional add-ons to the product the customer is viewing and persuade them to purchase more. They can also offer lucrative deals to customers, enticing them to buy more. For instance, a customer might not say no to a deal in which they get one blue light block eyewear for 30 $ but two of the same product when bought together, cost 40$. The extra dollar the customers spend here becomes additional revenue for the e-commerce business. Besides fetching good income, upselling also increases inventory turnover for businesses.

Incorporate messenger bots

E-commerce businesses can enhance customer experience through messenger bots and effectively manage the holiday sale rush during Q4. It allows them to simultaneously reach new customers, generate leads, and create an avenue to interact with the consumer. Also, by integrating messenger bots into social media platforms like Facebook, businesses can share ads and showcase products. It enables them to filter out interested buyers and automate certain aspects of the sales cycle, thus streamlining operations.
Businesses can also include technical SEO overhaul, e-commerce PPC advertising, and other methods to drive website traffic and optimize sales capabilities.

Wrapping up

A well-prepared Q4 e-commerce marketing plan is a big step in the right direction for businesses. It will arm them with the much-needed goals and guidance to make the most of this lucrative quarter with confidence. With an effective plan, e-commerce businesses can avoid mistakes that will cost them dear, get the most out of their buck, and be in a better position for success.

Featured image by Sevenatoms

The post A Guide to Q4 Ecommerce Marketing Plan appeared first on noupe.

Categories: Others Tags:

Unique Corporate Gift Ideas That Will Impress Your Clients and Partners

October 4th, 2023 No comments

Corporate gifting is a powerful tool that has gained significant importance in the business world. It involves the practice of giving thoughtful and carefully chosen gifts to employees, clients, partners, or other stakeholders in a professional setting to improve, strengthen, boost, or create a positive business relationship.

Corporate gifting is important for: 

1. Relationship Building: Corporate gifting is an effective means of fostering and strengthening relationships. Whether it’s with clients, employees, suppliers, or business partners, giving thoughtful gifts can create a sense of goodwill and appreciation. This, in turn, can lead to improved cooperation, trust, and loyalty.

2. Expressing Gratitude: Corporate gifting allows organizations to express gratitude and appreciation for the contributions of their stakeholders. It sends a message that their efforts are recognized and valued, which can boost morale and motivation among employees and encourage repeat business from clients.

3. Enhancing Brand Image: Thoughtful corporate gifts can help enhance a company’s brand image. When recipients associate positive experiences and sentiments with a brand, it can lead to increased brand loyalty and positive word-of-mouth marketing.

4. Celebrating Milestones: Corporate gifting can be a way to celebrate important milestones, such as anniversaries, achievements, or successful partnerships. Recognizing these occasions with a meaningful gift can leave a lasting impression and reinforce the significance of these milestones.

Benefits of Corporate Gifting include:

1. Strengthening Business Relationships: Corporate gifting helps build and maintain strong relationships with clients, partners, and employees. This can lead to increased collaboration, trust, and a better working environment.

2. Boosting Employee Morale: Recognizing and rewarding employees through gifts can boost morale, increase job satisfaction, and improve employee retention rates. It shows that the organization values its workforce.

3. Marketing and Branding Opportunities: Corporate gifts often carry the company’s logo or branding, serving as a subtle but effective marketing tool. When recipients use or display these items, they inadvertently promote the company to a wider audience.

4. Differentiation and Competitive Edge: Thoughtful corporate gifting can set a company apart from its competitors. It can be a way to stand out in a crowded marketplace and create a positive impression.

Understanding Your Clients and Partners:

Understanding your clients and partners, researching their preferences and interests, and considering their business needs and values is crucial for several reasons. Firstly, it enables you to build trust and rapport by demonstrating that you genuinely care about their individuality and success. This personalized approach fosters stronger, more enduring relationships.

Secondly, by aligning your products, services, and communications with their preferences and values, you increase the likelihood of meeting their specific needs and expectations. This leads to higher customer and partner satisfaction, potentially resulting in increased loyalty and repeat business.

Furthermore, understanding their business needs and values helps you identify opportunities for collaboration and mutual growth. It allows you to tailor your offerings to provide tangible solutions, making you a more valuable and strategic partner.

In today’s competitive landscape, where customer and partner choices abound, this understanding sets you apart and positions you as a trusted ally. Ultimately, it enhances the likelihood of successful, long-term partnerships and contributes to the overall success of your business.

Creative and Personalized Gift Ideas:

Certainly, personalized and creative gifts can leave a lasting impression on clients, partners, and employees. Here are more ideas to consider:

1. Customized Gift Baskets: Create themed gift baskets tailored to individual preferences. For instance, a “Coffee Lover’s Basket” could include gourmet coffee, a personalized mug, and artisanal snacks.

2. Name Engraved Tech Accessories: Items like phone cases, laptop sleeves, or wireless chargers engraved with the recipient’s name or initials add a personal touch and are practical for everyday use.

3. Personalized Books: Consider gifting a book that aligns with the recipient’s interests or career aspirations. Include a handwritten note inside to make it even more special.

4. Customized Apparel: Design custom clothing items such as t-shirts, hoodies, or jackets with the recipient’s name or a witty slogan that reflects their personality.

5. Subscription Services: Gift subscriptions to services like streaming platforms, book clubs, or gourmet food deliveries, based on the recipient’s preferences.

6. Artisanal Food and Beverage: Personalize a selection of gourmet chocolates, wines, or craft beers with custom labels or packaging.

NOTE: the key to successful personalized gifts is genuine thought and consideration. Tailor each gift to the recipient’s unique tastes and preferences, and you’ll create a memorable and cherished gesture of appreciation.

High-Quality and Practical Gifts:

1. Premium Office Accessories or Tech Gadgets:

   – Leather-bound notebooks or portfolios.

   – High-end noise-canceling headphones.

   – Top-tier ergonomic office chairs or standing desks.

   – A smartwatch or fitness tracker for health and productivity.

   – Quality desk lamps with adjustable lighting.

2. Executive-Style Stationery or Desk Organizers:

   – Monogrammed leather desk sets.

   – Luxury fountain pens or designer writing instruments.

   – Handcrafted wooden desk organizers.

   – High-quality, personalized business cards.

   – Customized leather mouse pads.

3. Useful Items for Professional Networking or Travel:

   – A premium leather travel wallet or passport holder.

   – Business card holders made from fine materials.

   – High-quality leather or vegan leather laptop bags.

   – A portable power bank with fast charging capabilities.

   – Noise-canceling travel headphones for long flights.

Gourmet and Luxury Gifts:

1. Artisanal Food and Beverage Selections:

   – A gourmet cheese and charcuterie board.

   – A subscription to a high-end coffee or tea service.

   – Truffle-infused olive oil or other specialty oils.

   – Handcrafted chocolates or truffles.

   – A collection of exotic spices and seasonings.

2. Fine Wines, Spirits, or Gourmet Gift Baskets:

   – A bottle of rare vintage wine or champagne.

   – A whiskey or scotch tasting set with premium selections.

   – A curated gourmet gift basket with a selection of fine cheeses, crackers, and preserves.

   – A personalized wine or whiskey decanter set.

   – A premium cocktail mixing kit with artisanal ingredients.

3. High-End Personalized Gift Sets:

   – Custom-made luxury leather goods like wallets or belts.

   – Monogrammed or engraved crystal glassware.

   – Personalized jewelry made from precious metals.

   – A bespoke suit or tailored clothing.

   – Custom fragrances created by a perfumer to suit their preferences.

Sustainable and Eco-Friendly Gifts:

1. Environmentally Conscious Products and Packaging:

   – Reusable stainless steel or glass water bottles.

   – Eco-friendly reusable shopping bags made from recycled materials.

   – Solar-powered gadgets or chargers.

   – Sustainable clothing or accessories made from organic or recycled fabrics.

   – Beeswax wraps as an alternative to plastic wrap.

2. Eco-Friendly Office Supplies or Reusable Items:

   – Recycled paper notebooks and stationery.

   – Bamboo or recycled plastic desk organizers.

   – Reusable bamboo or stainless steel straws.

   – Energy-efficient LED desk lamps.

   – Eco-friendly lunch containers and utensil sets.

3. Donations to Charitable Organizations on Behalf of Recipients:

   – Make a donation to a charity or environmental organization that aligns with the recipient’s values and interests.

   – Provide a certificate or acknowledgment of the donation as a gift.

Budget-Friendly Gift Ideas:

1. Thoughtful Gifts That Don’t Break the Bank:

   – Personalized photo albums or framed pictures.

   – A potted plant or succulent.

   – A book by the recipient’s favorite author.

   – Handwritten letters or a heartfelt poem.

   – A mixtape or playlist of favorite songs.

2. DIY or Handmade Items with a Personal Touch:

   – Hand-knit scarves, hats, or mittens.

   – Homemade candles or bath salts.

   – Create custom artwork or crafts.

   – Bake cookies, brownies, or other treats.

   – Compile a scrapbook of memories together.

3. Creative and Cost-Effective Alternatives:

   – Host a movie night or game night at home.

   – Offer to help with chores or tasks for a day.

   – Create a coupon book with special favors or experiences.

   – Plan a picnic or outdoor adventure.

   – Share a digital photo album or slideshow.

Packaging and Presentation:

1. Attention to Detail in Gift Wrapping and Packaging:

   – Use recycled or reusable gift-wrapping materials.

   – Incorporate natural elements like twine, leaves, or pinecones.

   – Wrap gifts in fabric or scarves that can be reused.

   – Choose eco-friendly wrapping paper with plant-based inks.

2. Including Personalized Messages or Notes:

   – Write a heartfelt message or letter to accompany the gift.

   – Share a meaningful quote or inside joke.

   – Express your gratitude and appreciation in words.

3. Enhancing the Overall Presentation for a Wow Factor:

   – Add a small bouquet of fresh flowers.

   – Include a small, thoughtful accessory or token.

   – Arrange the gifts aesthetically in a gift basket or box.

   – Tie a decorative ribbon or bow around the package.

These sustainable, budget-friendly, and creatively presented gifts can be just as meaningful and memorable as more expensive options, showcasing your thoughtfulness and care for the recipient.

Importance of Timing and Delivery:

1. Considerations for Appropriate Timing of Gift-Giving:

   – Timing can greatly impact the effectiveness and thoughtfulness of a gift. Consider giving gifts on special occasions such as birthdays, holidays, or work anniversaries.

   – Timing can also be crucial in personal relationships. For example, giving a sympathy gift promptly after a loss shows care and support.

2. Choosing Reliable Delivery Methods:

   – Select a reputable and dependable delivery service to ensure your gift arrives on time and in good condition.

   – Tracking and providing the recipient with delivery updates can be helpful in managing expectations.

3. Ensuring Gifts Arrive in Excellent Condition:

   – Properly package delicate or fragile items to prevent damage during transit.

   – Include clear instructions for handling and unpacking if necessary.

Etiquette and Professionalism:

1. Understanding Cultural Norms and Customs:

   – Different cultures have unique customs and etiquette related to gift-giving. Research and respect the cultural norms of the recipient to avoid unintended offense.

   – Be aware of taboos or inappropriate gifts in the recipient’s culture.

2. Proper Gift-Giving Etiquette in Business Settings:

   – In business contexts, gifts should be thoughtful but not overly personal or extravagant.

   – Check a company’s policy on gift acceptance, as some organizations have strict rules regarding gifts to employees.

   – Avoid giving gifts that may create conflicts of interest or appear as bribery.

3. Building and Maintaining Professional Relationships:

   – Thoughtful gift-giving can strengthen professional relationships and foster goodwill.

   – Be mindful of the recipient’s preferences and interests to choose an appropriate gift.

   – Handwritten thank-you notes or follow-up messages after gift-giving can further enhance your professional image.

4. Avoiding Gift Expectations:

   – In some situations, it’s best to avoid gifts to prevent any perception of favoritism or obligation.

   – If you receive a gift, reciprocate appropriately and consider the nature of your relationship with the giver.

5. Giving and Receiving Gracefully:

   – When receiving a gift, express genuine gratitude and appreciation, regardless of the gift’s value.

   – When giving a gift, do so with sincerity and without expecting something in return.

In both personal and professional settings, timing, delivery, and etiquette play essential roles in successful gift-giving. Thoughtful consideration of these factors can lead to meaningful exchanges and the building of positive relationships.

Conclusion:

Unique corporate gifts that truly impress clients and partners are those that reflect genuine consideration and appreciation. Whether it’s the sustainability of your gift, the personal touch of a handwritten note, or the perfect timing of your gesture, these elements collectively convey your commitment to fostering meaningful relationships.

Selecting gifts that align with your recipient’s interests, preferences, and cultural norms is key to leaving a lasting impression. The art of gift-giving in the corporate world goes beyond monetary value; it’s about the sentiment, the message, and the goodwill you convey.

Remember, it’s not about the price tag but the thought and effort you invest in selecting, packaging, and delivering your gifts. A well-timed, well-chosen gift can help solidify partnerships, express gratitude, and create a positive image for your company.

So, as you embark on the journey of corporate gift-giving, consider the unique tastes and needs of your clients and partners, adhere to proper etiquette, and embrace the opportunity to strengthen and nurture professional relationships. These thoughtful gestures will undoubtedly make a lasting impression that extends far beyond the immediate exchange. Happy Gifting!!!

The post Unique Corporate Gift Ideas That Will Impress Your Clients and Partners appeared first on noupe.

Categories: Others Tags:

The Problem With WordPress Is Positioning, Not Plugins

October 3rd, 2023 No comments

Ask just about any casual user to explain the difference between WordPress.org and WordPress.com, and you’re likely to get a shrug in response. I know this because it’s one of the first things I ask students in my WordPress development course each semester when introducing them to the content management system.

I love asking that question because it boggles my mind that a platform responsible for powering 43% of the internet can go largely unrecognized, the same sort way Taylor Swift can walk into a packed football stadium unnoticed.

But among the power users and developers among us, the difference between WordPress.org and WordPress.com is not only apparent but a divide that draws a sacred but blurry line between the lively open-source community that WordPress is known for, and the commercial efforts of Automattic, the company that uses WordPress to power its hosted CMS platform.

The difference is a sacred line because crossing it tarnishes the open-source-ness of WordPress as a decentralized project maintained by a community of largely unpaid contributors.

Keeping special interests out of the mix is what keeps WordPress for the people, by the people.

That sacred line is also blurry, at best, and a great example of that popped up this past week when WordPress.com published a clone of the WordPress.org Plugin Directory to its own site. As is usually the case with WordPress #HotDrama, one or two developers take notice of a change, post a tweet about it, and Automattic founder Matt Mullenweg splashes a little kerosene on it. In this particular case, plugin pages on WordPress.com appeared to outrank plugin pages on WordPress.org in web searches.

This is yet another example of a situation that pits the open-source community against Automattic’s commercial interests. We’ve been here plenty of times in the 20-plus years that WordPress has been with us. The debates are nuanced, of course, but I’ll loosely characterize each side’s point in broad strokes:

  • WordPress.org: You are using the sweat equity of the open-source community to advance your own company.
  • WordPres.com: Hey, we’re merely distributing your work to a larger audience in a way we both benefit.

The problem is that this is where the debate often moves from being productive to getting downright dirty. No one benefits in these conditions.

It’s possible for both sides of the debate to be true, even if they do not agree. It would be just as disingenuous for plugin developers to claim no benefit from WordPress.com’s exposure as it is for Automattic to claim that developers gain as much in rewards as they spend writing code.

And therein lies the rub. When the discussion veers towards labor concerns and hurt feelings, we get away from the real issue at heart: WordPress has a positioning problem, not a plugin problem.

Sure, that makes for a spicy headline, but there’s real substance to it. How different would it be if the debate was between WordPress and Automattic rather than WordPress against WordPress? I imagine it would be quite different.

It is no longer an issue of search rankings and blocked accounts but one that is truly about distribution and labor in the open-source community.

When we draw sharper lines between business and community, we can have clearer discussions without the blurry divisions getting in the way and throwing the conversation off-topic.

This is the absolute perfect time to reposition WordPress. Five years after Matt’s famous advice to “Learn JavaScript deeply,” WordPress has transformed into an entirely visual editing experience that has radically transformed how we interact with it, both as users and developers. The “Gutenberg” project — and the full-site editing capabilities it brought — has ushered in a new era of WordPress where everyone’s relationship with it has changed. It’s time to change the general perception of WordPress as far as what it is and what it’s used for while we are at it.

It’s possible that a product becomes so successful or changes so drastically that it no longer fits under its own umbrella. Facebook becomes Meta. Google becomes Alphabet. Twitter has become whatever it is today. Products and companies evolve over time like people. This is what has happened with WordPress.com and WordPress.org. Each is vying for their own identity and winds up battling each other rather than buttressing one another. A cloned version of the WordPress.org Plugin Directory on WordPress.com exacerbates the issue rather than solving it. We’ve really reached the point of diminishing returns with the “WordPress” brand equity.

The only way this is fixed is by shedding the “WordPress” label from Automattic’s commercial efforts. Matt is not wrong when he claims that shared branding has made it difficult for services like Typepad to compete in the CMS space. That was true for a long time. But with a 43.1% market share today, is there really an existential threat to WordPress that requires co-branding two different flavors of WordPress? The current threat to WordPress’ market dominance has more to do with its future as a product and how it competes in a world of low-code and no-code platforms. There’s no amount of co-branding that is capable of solving what is, in essence, a user interface and experience challenge.

In that same tweet, Matt also asks us to imagine what WordPress would look like without co-branding, pointing to Joomla as a case in point. Again, co-branding may indeed have helped get WordPress to where it is today. But to say that it always has and always will is a large leap in logic on a false premise. Co-branding may not always be the best or only way to maintain market share or beat the competition. To think so is errant and myopic in a way that assumes no other possibilities, ever, as if past successes always lead to new ones. Myopia often sows the seeds of failure.

I believe we’ve reached the point where we ought to at least question co-branding as a strategy and consider whether there are happier paths to follow. If I have to imagine what WordPress looks like without co-branding today instead of in the past, I see the possibility of a clear separation of concerns between business and community interests because, at this point, there is little to no difference between running a WordPress site on WordPress.com’s servers on its Business Plan and self-hosting the site on a managed host like WP Engine. You get the same access to the same files for the same underlying software that is used to power WordPress.com, the same as it is used to power any other website that chooses to download and self-host WordPress.

That said, I am not totally against co-branding. The problem could be as much about not going far enough with co-branding as it is having too much of it. As it currently stands, the similarities between WordPress.com and WordPress.org are too indistinguishable at first glance that perhaps sharing the same top-level domain name only muddies the perceived similarities — or differences — even more. Perhaps there’s a happy path that gives credit to both perspectives in the debate with more explicit names, such as WordPress Platform and WordPress CMS. Those are terrible names, but hopefully, you get what I am aiming at.

The bottom line is this: We have danced around WordPress’ positioning problem way too long, hiding behind its past successes while tension between commercial and community interests continues to boil over. Rather than allowing this to continue by sitting somewhere in the middle with a shared brand name, maybe we’ll see a day where we go all-in on a direction either by renaming WordPress.com to allow WordPress.org to be WordPress or leaning deeper into effective co-branding that properly distinguishes the two properties while leveraging the “WordPress” brand.

References And Resources

Categories: Others Tags:

Mastering Responsive Web Design: Techniques and Best Practices for Cross-Device Compatibility

October 3rd, 2023 No comments

Need to create a website, landing page, or blog that can deliver a pristine customer experience across a range of devices? 

Look no further than responsive web design, a strategy that focuses on creating a fluid layout to create congruent interfaces for desktop and mobile users.

In this article, we’ll take a closer look at what responsive design really means, three ways to create it, and two examples of optimal websites with flexible designs. We’ve also included a bonus checklist for you to help you refine your layout before going live.

Ready to learn more?

Let’s get started.

What is responsive website design? 

Coined by Ethan Marcotte, otherwise known as “The Godfather of RWD”, responsive web or website design means creating a website that looks clean, intuitive, and functions well, regardless of the device type it’s viewed on.

According to Ethan, having a “device-agnostic layout” is key. This can be accomplished using flexible images, media queries, and fluid gridsthe three pillars of a responsive design.

In his original article on the subject, Ethan referenced the following quote which perfectly depicts the power of responsive web design (RWD).

“The control which designers know in the print medium, and often desire in the web medium, is simply a function of the limitation of the printed page. We should embrace the fact that the web doesn’t have the same constraints and design for this flexibility. But first, we must accept the ebb and flow of things.” — John Allsopp, A Dao of Web Design

2 examples of optimal websites with cross-device compatibility 

In today’s digital era, a website’s cross-device compatibility has become paramount for delivering a seamless and engaging user experience. 

Ensuring that blog posts, landing pages, and other content have comprehensive navigation and are visually appealing across a variety of devices is crucial for capturing and retaining user attention.

Two notable examples of well-optimized websites include the Hers blog and Clean Origin’s diamond stud-earring collection page. 

Let’s explore how these exemplify the significance of cross-device compatibility.

The Hers blog 

For Hers, a well-optimized blog means that users can easily access insightful information about topics like the effects of Adderall on mental health and other wellness resources from any device. 

Whether on a computer, tablet, or mobile phone, Hers’ content retains a responsive layout without sacrificing design quality. Here’s the desktop version: 

Desktop version of a website for hers.

(Image Source)

And here’s the mobile version:

Mobile version of a website for hers.

(Image Source)

This cross-device compatibility empowers users to educate themselves and make informed decisions regardless of their location or preferred viewing device. What’s more, the smooth user experience provided by the responsive design can help enhance user satisfaction and foster trust in the brand’s expertise and credibility.

Clean Origin’s diamond stud-earring collection page

Clean Origin’s well-optimized landing page for its diamond stud-earring collection offers stunning visuals that are equally captivating on both desktop and mobile screens.

Here’s a peek at how it looks on a desktop:

Desktop version of a website for Clean Origin.

(Image Source)

And this is how it looks on a mobile device:

Clean Origin mobile version of a website.

(Image Source)

This cross-device compatibility ensures that users can enjoy browsing through the exquisite earring designs and easily select their favorite from any location or device. The seamless transition from one device to another facilitates a seamless shopping experience, maximizing customer engagement and increasing the likelihood of conversions.

But the advantages of cross-device compatibility extend beyond user satisfaction. 

Cross-device compatibility can also positively impact search engine rankings, as major search engines prioritize mobile-friendly websites, considering them more relevant and user-oriented.

Websites that cater to various devices can receive higher visibility and reach broader audiences, ultimately leading to increased organic traffic and inspiring business growth.

3 ways to create cross-device compatibility 

Now that you’re clear on the basics, let’s take a look at three ultra-simple ways you can master responsive web design when working on your next design project.

1. Use a grid system

If you’re a coding enthusiast who loves having control over every stage of development, responsive grid systems, like Flexbox Grid, Zimit Framework, or Bootstrap, might just be your thing. 

Grid system example.

(Image Source)

Grid systems provide all of the necessary building blocks you’ll need to create responsive web design, including containers, columns, rows, and classes for organizing and nesting elements. 

With media queries and popular breakpoints, these systems smoothly adapt to different screen sizes.

When it comes to responsive grid systems, there’s a wide variety to choose from. Some are simple and straightforward, while others are more comprehensive and feature-rich. Jot down your top priorities before shopping for grid system software.

2. Use a responsive website builder

If you’re looking for an easy and flexible way to create a responsive website, website builders have got you covered! 

Whether you’re a tech guru or a beginner, these user-friendly platforms provide features you can use to build your website without needing to touch a single line of code. Features may include browser-based drag-and-drop editors, advanced customization options, and hundreds of stylish blocks.

Grid system example.

(Image Source)

Some responsive website builders focus on responsive behavior, while others prioritize mobile-friendliness, offering tools to optimize your site for different devices.

Hiring React JS developers with expertise in building responsive web applications can also be a great option to ensure your website meets your specific requirements.

If you’re interested in using a responsive website builder, check out options like SpringBuilder, Designmodo Startup, and Visual Composer.

3. Use a CMS

Another simple way to create cross-device compatibility is by using a Content Management System (CMS) like WordPress or Shopify. Hint: If you need an easy way to create a responsive blog or ecommerce store, this option may be your best bet! 

These user-friendly platforms are designed to cater to both tech-savvy individuals and those new to web development

Although CMS platforms may not initially provide responsive behavior, the good news is that many theme developers have recognized the importance of mobile optimization. With this in mind, they’ve created a plethora of responsive templates that seamlessly adapt to different screen sizes, guaranteeing a smooth browsing experience on mobile and desktop devices.

Example of Shopify templates.

(Image Source)

Whichever method you choose, don’t go live until testing your website on a variety of devices. Head to the checklist in the next section for additional support.

Cross-device compatibility checklist

Here’s the bonus checklist we promised you. ??

Before going live, make sure your new web page can pass the following cross-device compatibility checklist: 

Does my website, landing page, or blog:

  • uncheckedFeel and look intuitive on larger screens and smaller screens?
  • uncheckedHave plenty of white space to decrease overwhelm and promote readability? 
  • uncheckedLook beautiful and professional on mobile and desktop browsers?
  • uncheckedFunction correctly across desktop and mobile versions? 
  • uncheckedHave responsive images and correct image sizes?

Wrap up 

And there you have it. 

Today we discussed what responsive web design is, some simple techniques to help you master it, and two examples of optimal websites with cross-device compatibility. 

If you’re ready to get started on your next project, don’t forget to bookmark this article and share it with your web development team. 

And if you’re looking for even more insightful advice you can apply to your business, check out our online magazine for additional guides and resources.

Here’s to your success!

Featured image by Domenico Loia on Unsplash

The post Mastering Responsive Web Design: Techniques and Best Practices for Cross-Device Compatibility appeared first on noupe.

Categories: Others Tags:

5 Top Benefits of Conversational Marketing for Your Business

October 3rd, 2023 No comments

Sending targeted marketing messages is a great way to build brand awareness, boost sales, and generate leads. However, this one-way interaction may not be enough to reach customers wanting to engage with their favorite brands.

Nearly 70% of customers prefer to use conversational marketing chatbots because of how quickly they can initiate a conversation with a business on their own time.

A conversational marketing strategy can help you provide customers with the immediacy they crave.

What Is Conversational Marketing? 

Conversational marketing is just what the name suggests. It’s a form of marketing that focuses on interacting with potential customers through two-way communications (either in real-time conversations or client-time conversations) — more on that in a bit.  

If you’ve ever shopped online, there’s a strong chance that you’ve engaged in conversational marketing before. 

You might see a chat icon with a message pop-up when you visit a website. It might say something like “Hi, welcome to….How can I help you today?” or something more specific that ties to that product or service offering.

For example, Carmax features a chatbot that caters to a wide range of car buyer needs, from setting appointments to finding more information about financing.

Carmax chatbot
Image Source

This scenario is conversational marketing in action. The goal is to engage website visitors and convert them into leads through conversation, often through automation or artificial intelligence tools. 

Customers’ actions will trigger a chatbot, like when they spend a lot of time looking at a product page. The chatbot may ask if the customer wants to learn more about the product. 

But that’s just the tip of the iceberg. Conversational marketing can take many other forms. Examples include lead-generation chatbots (like the example above), social media chatbots, live chat, voice assistants, and email. 

How Conversational Marketing Works

In an ideal conversational marketing strategy, conversation happens in “customer time.” In other words, conversations take place whenever the customer wants. 

It doesn’t have to be in real-time. It can be whatever time is most convenient for the customer. So, conversational marketing should focus on the needs of the customer. 

Conversational marketing meets customers where they are. So, for example, imagine that your customer base spends a lot of time on Facebook. 

It may be best to set up a chatbot within Facebook Messenger to answer questions and boost the chances of converting these customers. Why?

Because your customers already use Facebook multiple times per week, it’d be much easier for them to send a message on the app than perform a Google search for your company’s number or email address. 

For example, if a potential customer is looking for linen suits for men, and there’s an option to message the brand directly in the app about sizing and turnaround times, it creates a seamless shopping experience.

Example of StudioSuits Facebook Messanger chat.
Image Source

And if there’s an indicator that the brand responds quickly (in this case, instantly), then it’s an even better solution. A customer can get real-time answers for all of their shopping-related questions. The result? Lower bounce rates. And higher conversions. What’s not to love?

Keep in mind that your conversational marketing efforts should be easily scalable. The last thing you want is for your business to get left behind because you don’t have the staffing or budget to serve your customers. Enter chatbots. 

Bots are valuable in a conversational marketing strategy because they already have answers prepared for the most common questions based on data that already exists. That takes the burden off your customer support team. And chatbots can work 24/7 a day (no beauty rest required).

That’s not to say that chatbots should replace humans. But bots are useful when a customer needs a quick answer to a simple question. If the bot can’t help with a particular inquiry, it should provide quick access to a live rep.

With a detailed sales playbook in hand, your sales reps can follow all the correct steps during the sales process to overcome common sales objections and close the deal. Think of it as a foolproof guide to engaging with customers throughout the sales cycle.

AI-powered chatbots and the human touch are a dynamic duo for turning prospects into customers. Align them together and watch your sales soar.  

Industries Using Conversational Marketing

There are a few industries that are frontrunners for harnessing the power of conversational marketing. So, if you need inspiration, take a peek at these two examples.  

Healthcare

Healthcare is a major industry that requires human interaction. A healthcare brand like Henry Meds can benefit from using conversational marketing to help patients quickly get the information they need about Henry Meds’ products, services, or health-related concerns. 

But that’s not all. Through conversational marketing, Henry Meds can provide personalized treatment plans in three simple steps.

Here’s how it works:

  1. Complete a simple online form with your health history.
  2. Schedule a telehealth consultation at your convenience.
  3. Receive your medication delivered to your doorstep.
Telehealth example of conversational marketing.
Image Source

Henry Meds adds conversation and convenience to a traditionally cumbersome process. It’s one of the many drivers behind telehealth’s impressive growth rates over the past few years. 

Local Businesses

Businesses that provide local services can also leverage conversational marketing to engage with their customers and reduce friction throughout the buying process. 

For example, Watermill Flowers, a florist in Fort Lauderdale, uses real-time order assistance to guide customers through the ordering process, help them choose the right floral arrangements, and address any concerns.

Watermill Flowers uses a chatbot on Facebook Messenger to answer customer questions and take orders.

Watermill Flowers Facebook Messenger chatbot
Image Source

This local business showcases another great example of where instant responses can boost consumer trust in a brand. Why? Customers can get their questions answered (at their beck and call) before deciding on a purchase.

And if that purchase doesn’t happen with your brand, they’ll run into the open arms of the next local business that appears on the search engine results page (SERP). 

5 Benefits of Conversational Marketing

1. Get to Know Your Customers

When you set up a chatbot, it automatically collects key information about your site visitors. 

During a conversation, your buyer’s responses can give you valuable insights into:

  • Why did they come to your site
  • Their biggest pain points
  • What product features do they care about

By the end of the conversation, you’ll qualify them and understand whether a lead fits your ideal customer profile.

2. Create a Positive Customer Experience

Because conversational marketing helps you learn more about your customers’ needs and pain points, you can create personalized experiences.

For example, you can adjust your conversations and recommend certain products or services based on customer interests and where they fall in the customer journey.

3. Build Customer Loyalty

Conversational marketing allows you to respond quickly to customer support issues. Or help customers make a purchase decision by providing key information. 

These gestures create a positive feeling, build trust, and increase customer loyalty. Customers are more likely to make a purchase with a brand they trust and keep coming back for a positive buying experience, boosting your conversation rates.

4. Create a More Human Touch 

Today’s customers want to feel connected to the brands they interact with. 

So, use customer data wisely to tailor conversations. Address users by name, remember past interactions, and offer relevant recommendations.

Make chatbots feel more human by giving them names, personalities, and avatars. Program them to understand context and emotions, and occasionally use informal language or emojis, where appropriate.

And if a chatbot can’t answer a query, ensure a smooth transition to a human representative.

5. Provide Real-time Feedback and Answers

Customers usually browse through a product catalog or list of services before they make a buying decision.

If they need further information, they may engage with someone from the sales team or a customer service rep over the phone. But this often requires waiting, which can hurt sales in the age of instant gratification. 

No one wants to spend minutes or hours waiting on hold for a customer service rep to answer their call. Or wait days for an email response. That’s the quickest way to frustrate customers and lose them to a competitor that provides faster support.

Chatbots can help you give your customers the immediacy they’re looking for when it comes to answering their questions or problems.

Plus, customers may prefer to interact with a chatbot over an actual human, especially if they just need a quick answer to a question. For instance, Albert, a personal finance and mobile banking app, uses a chatbot to answer financial questions on the spot. 

Albert Genius chatbot
Image Source

In short, a chatbot can meet your customer’s needs by giving customers answers in real-time or when they need them most. 

Move More Leads Down the Sales Funnel With Conversational Marketing

Conversational marketing is about understanding and meeting our customers in their comfort zone. It’s like having a genuine chat with a friend, offering assistance right when they need it. 

This strategic approach builds trust and guides potential customers smoothly through the sales journey.

So, as you plan your next marketing move, consider integrating conversational tactics. It’s time to truly connect with your audience. Your customers will be grateful, and your profits will show it.

Featured image by Freepik

The post 5 Top Benefits of Conversational Marketing for Your Business appeared first on noupe.

Categories: Others Tags:

WaterBear: Building A Free Platform For Impactful Documentaries (Part 2)

October 2nd, 2023 No comments

In my previous article, I talked about Waterbear, a significant project I worked on as a newly-appointed lead developer, and the lessons I learned leading a team for the first time. In this second article, I’ll go over some key technical highlights from the project. Before we start, let’s quickly remind ourselves what WaterBear is all about and what makes it so interesting.

WaterBear is a free platform bringing together inspiration and action with award-winning high-production environmental documentaries covering various topics, from animals and climate change to people and communities. The WaterBear team produces their own original films and documentaries and hosts curated films and content from various high-profile partners, including award-winning filmmakers, large brands, and significant non-governmental organizations (NGOs), like Greenpeace, WWF, The Jane Goodall Institute, Ellen MacArthur Foundation, Nikon, and many others.

For context, I am currently working at a software development company called Q Agency based in Zagreb, Croatia. We collaborated with WaterBear and its partner companies to build a revamped and redesigned version of WaterBear’s web and mobile app from the ground up using modern front-end technologies.

In the first article, I briefly discussed the technical stack that includes a React-based front-end framework, Next.js for the web app, Sanity CMS, Firebase Auth, and Firestore database. Definitely read up on the strategy and reasoning behind this stack in the first article if you missed it.

Now, let’s dive into the technical features and best practices that my team adopted in the process of building the WaterBear web app. I plan on sharing specifically what I learned from performance and accessibility practices as a first-time lead developer of a team, as well as what I wish I had known before we started.

Image Optimization

Images are pieces of content in many contexts, and they are a very important and prominent part of the WaterBear app’s experience, from video posters and category banners to partner logos and campaign image assets.

I think that if you are reading this article, you likely know the tightrope walk between striking, immersive imagery and performant user experiences we do as front-enders. Some of you may have even grimaced at the heavy use of images in that last screenshot. My team measured the impact, noting that on the first load, this video category page serves up as many as 14 images. Digging a little deeper, we saw those images account for approximately 85% of the total page size.

That’s not insignificant and demands attention. WaterBear’s product is visual in nature, so it’s understandable that images are going to play a large role in its web app experience. Even so, 85% of the experience feels heavy-handed.

So, my team knew early on that we would be leveraging as many image optimization techniques as we could that would help improve how quickly the page loads. If you want to know everything there is to optimize images, I wholeheartedly recommend Addy Osami’s Image Optimization for a treasure trove of insightful advice, tips, and best practices that helped us improve WaterBear’s performance.

Here is how we tackled the challenge.

Using CDN For Caching And WebP For Lighter File Sizes

As I mentioned a little earlier, our stack includes Sanity’s CMS. It offers a robust content delivery network (CDN) out of the box, which serves two purposes: (1) optimizing image assets and (2) caching them. Members of the WaterBear team are able to upload unoptimized high-quality image assets to Sanity, which ports them to the CDN, and from there, we instruct the CDN to run appropriate optimizations on those images — things like compressing the files to their smallest size without impacting the visual experience, then caching them so that a user doesn’t have to download the image all over again on subsequent views.

Requesting the optimized version of the images in Sanity boils down to adding query variables to image links like this:

https://cdn.sanity.io/.../image.jpg?w=1280&q=70&auto=format

Let’s break down the query variables:

  • w sets the width of the image. In the example above, we have set the width to 1280px in the query.
  • q sets the compression quality of the image. We landed on 70% to balance the need for visual quality with the need for optimized file sizes.
  • format sets the image format, which is set to auto, allowing Sanity to determine the best type of image format to use based on the user’s browser capabilities.

Notice how all of that comes from a URL that is mapped to the CDN to fetch a JPG file. It’s pretty magical how a completely unoptimized image file can be transformed into a fully optimized version that serves as a completely different file with the use of a few parameters.

In many cases, the format will be returned as a WebP file. We made sure to use WebP because it yields significant savings in terms of file size. Remember that unoptimized 1.2 MB image from earlier? It’s a mere 146 KB after the optimizations.

And all 14 image requests are smaller than that one unoptimized image!

The fact that images still account for 85% of the page weight is a testament to just how heavy of a page we are talking about.

Another thing we have to consider when talking about modern image formats is browser support. Although WebP is widely supported and has been a staple for some time now, my team decided to provide an optimized fallback JPG just in case. And again, Sanity automatically detects the user’s browser capabilities. This way, we serve the WebP version only if Sanity knows the browser supports it and only provide the optimized fallback file if WebP support isn’t there. It’s great that we don’t have to make that decision ourselves!

Have you heard of AVIF? It’s another modern image format that promises potential savings even greater than WebP. If I’m being honest, I would have preferred to use it in this project, but Sanity unfortunately does not support it, at least at the time of this article. There’s a long-running ticket to add support, and I’m holding hope we get it.

Would we have gone a different route had we known about the lack of AVIF support earlier? Cloudinary supports it, for example. I don’t think so. Sanity’s tightly coupled CDN integration is too great of a developer benefit, and as I said, I’m hopeful Sanity will give us that support in the future. But that is certainly the sort of consideration I wish I would have had early on, and now I have that in my back pocket for future projects.

Tackling The Largest Contentful Paint (LCP)

LCP is the biggest element on the page that a user sees on the initial load. You want to optimize it because it’s the first impression a user has with the page. It ought to load as soon as possible while everything under it can wait a moment.

For us, images are most definitely part of the LCP. By giving more consideration to the banner images we load at the top of the page, we can serve that component a little faster for a better experience. There are a couple of modern image attributes that can help here: loading and fetchpriority.

We used an eager loading strategy paired with a high fetchpriority on the images. This provides the browser with a couple of hints that this image is super important and that we want it early in the loading process.

<!-- Above-the-fold Large Contentful Paint image -->
<img
  loading="eager"
  fetchpriority="high"
  alt="..."
  src="..."
  width="1280"
  height="720"
  class="..."
/>

We also made use of preloading in the document , indicating to the browser that we want to preload images during page load, again, with high priority, using Next.js image preload options.

<head>
  <link
    rel="preload"
    as="image"
    href="..."
    fetchpriority="high"
  />
</head>

Images that are “below the fold” can be de-prioritized and downloaded only when the user actually needs it. Lazy loading is a common technique that instructs the browser to load particular images once they enter the viewport. It’s only fairly recently that it’s become a feature baked directly into HTML with the loading attribute:

<!-- Below-the-fold, low-priority image -->
<img
  decoding="async"
  loading="lazy"
  src="..."
  alt="..."
  width="250"
  height="350"
/>

This cocktail of strategies made a noticeable difference in how quickly the page loads. On those image-heavy video category pages alone, it helped us reduce the image download size and number of image requests by almost 80% on the first load! Even though the page will grow in size as the user scrolls, that weight is only added if it passes through the browser viewport.

In Progress: Implementing srcset

My team is incredibly happy with how much performance savings we’ve made so far. But there’s no need to stop there! Every millisecond counts when it comes to page load, and we are still planning additional work to optimize images even further.

The task we’re currently planning will implement the srcset attribute on images. This is not a “new” technique by any means, but it is certainly a component of modern performance practices. It’s also a key component in responsive design, as it instructs browsers to use certain versions of an image at different viewport widths.

We’ve held off on this work only because, for us, the other strategies represented the lowest-hanging fruit with the most impact. Looking at an image element that uses srcset in the HTML shows it’s not the easiest thing to read. Using it requires a certain level of art direction because the dimensions of an image at one screen size may be completely different than those at another screen size. In other words, there are additional considerations that come with this strategy.

Here’s how we’re planning to approach it. We want to avoid loading high-resolution images on small screens like phones and tablets. With the srcset attribute, we can specify separate image sources depending on the device’s screen width. With the sizes attribute, we can instruct the browser which image to load depending on the media query.

In the end, our image markup should look something like this:

<img
  width="1280"
  height="720"
  srcset="
    https://cdn.sanity.io/.../image.jpg?w=568&...   568w,
    https://cdn.sanity.io/.../image.jpg?w=768&...   768w,
    https://cdn.sanity.io/.../image.jpg?w=1280&... 1280w
  "
  sizes="(min-width: 1024px) 1280px, 100vw"
  src="https://cdn.sanity.io/.../image.jpg?w=1280&..."
/>

In this example, we specify a set of three images:

  1. Small: 568px,
  2. Medium: 768px,
  3. Large: 1280px.

Inside the sizes attribute, we’re telling the browser to use the largest version of the image if the screen width is above 1024px wide. Otherwise, it should default to selecting an appropriate image out of the three available versions based on the full device viewport width (100vw) — and will do so without downloading the other versions. Providing different image files to the right devices ought to help enhance our performance a bit more than it already is.

Improving CMS Performance With TanStack Query

The majority of content on WaterBear comes from Sanity, the CMS behind the web app. This includes video categories, video archives, video pages, the partners’ page, and campaign landing pages, among others. Users will constantly navigate between these pages, frequently returning to the same category or landing page.

This provided my team with an opportunity to introduce query caching and avoid repeating the same request to the CMS and, as a result, optimize our page performance even more. We used TanStack Query (formerly known as react-query) for both fetching data and query caching.

const { isLoading, error, data } = useQuery( /* Options */ )

TanStack Query caches each request according to the query key we assign to it. The query key in TanStack Query is an array, where the first element is a query name and the second element is an object containing all values the query depends on, e.g., pagination, filters, query variables, and so on.

Let’s say we are fetching a list of videos depending on the video category page URL slug. We can filter those results by video duration. The query key might look something like this basic example:

const { isLoading, error, data } = useQuery(
  {
    queryKey: [
      'video-category-list',
      { slug: categorySlug, filterBy: activeFilter }
    ],
  queryFn: () => /* ... */
  }
)

These query keys might look confusing at first, but they’re similar to the dependency arrays for React’s useEffect hook. Instead of running a function when something in the dependency array changes, it runs a query with new parameters and returns a new state. TanStack Query comes with its dedicated DevTools package. It displays all sorts of useful information about the query that helps debug and optimize them without hassle.

Let’s see the query caching in action. In the following video, notice how data loads instantly on repeated page views and repeated filter changes. Compare that to the first load, where there is a slight delay and a loading state before data is shown.

We’re probably not even covering all of our bases! It’s so tough to tell without ample user testing. It’s a conflicting situation where you want to do everything you can while realistically completing the project with the resources you have and proceed with intention.

We made sure to include a label on interactive elements like buttons, especially ones where the icon is the only content. For that case, we added visually hidden text while allowing it to be read by assistive devices. We also made sure to hide the SVG icon from the assistive devices as SVG doesn’t add any additional context for assistive devices.

<!-- Icon button markup with descriptive text for assistive devices -->
<button type="button" class="...">
  <svg aria-hidden="true" xmlns="..." width="22" height="22" fill="none">...</svg
  ><span class="visually-hidden">Open filters</span>
</button>
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  white-space: nowrap;
  clip: rect(0 0 0 0);
  -webkit-clip-path: inset(50%);
  clip-path: inset(50%);
}

Supporting keyboard navigation was one of our accessibility priorities, and we had no trouble with it. We made sure to use proper HTML markup and avoid potential pitfalls like adding a click event to meaningless div elements, which is unfortunately so easy to do in React.

We did, however, hit an obstacle with modals as users were able to move focus outside the modal component and continue interacting with the main page while the modal was in its open state, which isn’t possible with the default pointer and touch interaction. For that, we implemented focus traps using the focus-trap-react library to keep the focus on modals while they’re opened, then restore focus back to an active element once the modal is closed.

Dynamic Sitemaps

Sitemaps tell search engines which pages to crawl. This is faster than just letting the crawler discover internal links on its own while crawling the pages.

The importance of sitemaps in the case of WaterBear is that the team regularly publishes new content — content we want to be indexed for crawlers as soon as possible by adding those new links to the top of the sitemap. We don’t want to rebuild and redeploy the project every time new content has been added to Sanity, so dynamic server-side sitemaps were our logical choice.

We used the next-sitemap plugin for Next.js, which has allowed us to easily configure the sitemap generation process for both static and dynamic pages. We used the plugin alongside custom Sanity queries that fetch the latest content from the CMS and quickly generate a fresh sitemap for each request. That way, we made sure that the latest videos get indexed as soon as possible.

Let’s say the WaterBear team publishes a page for a video named My Name is Salt. That gets added to a freshly generated XML sitemap:

Now, it’s indexed for search engines to scoop up and use in search results:

Until Next Time…

In this article, I shared some insights about WaterBear’s tech stack and some performance optimization techniques we applied while building it.

Images are used very prominently on many page types on WaterBear, so we used CDN with caching, loading strategies, preloading, and the WebP format to optimize image loading performance. We relied on Sanity for the majority of content management, and we expected repeating page views and queries on a single session, prompting us to implement query caching with TanStack Query.

We made sure to improve basic accessibility on the fly by styling focus states, enabling full keyboard navigation, assigning labels to icon buttons, providing alt text for images, and using focus traps on modal elements.

Finally, we covered how my team handled dynamic server-side rendered sitemaps using the next-sitemap plugin for Next.js.

Again, this was my first big project as lead developer of a team. There’s so much that comes with the territory. Not only are there internal processes and communication hurdles to establish a collaborative team environment, but there’s the technical side of things, too, that requires balancing priorities and making tough decisions. I hope my learning journey gives you something valuable to consider in your own work. I know that my team isn’t the only one with these sorts of challenges, and sharing the lessons I learned from this particular experience probably resonates with some of you reading this.

Please be sure to check out the full work we did on WaterBear. It’s available on the web, Android, and iOS. And, if you end up watching a documentary while you’re at it, let me know if it inspired you to take action on a cause!

References

Many thanks to WaterBear and Q Agency for helping out with this two-part article series and making it possible. I really would not have done this without their support. I would also like to commend everyone who worked on the project for their outstanding work! You have taught me so much so far, and I am grateful for it.

Categories: Others Tags:

Exciting New Tools for Designers, October 2023

October 2nd, 2023 No comments

Welcome to our all treats-no tricks, October tools collection.

Categories: Designing, Others Tags: