Showing posts with label SPA AEM. Show all posts
Showing posts with label SPA AEM. Show all posts

Monday 8 April 2019

Making SPA's(Single Page Applications) SEO(Search Engine Optimized) Friendly in AEM

AEM now supports SPA SDKs which helps to create Single Page Applications using Angular and React JS. A Single Page Application is a java script code which injects new content from a server into a page without the entire page getting reloaded in the browser. This gives the advantage of faster loading websites.


If we dont take care of SEO from beginning, we may have to put extra efforts to go back and fix the indexing issues later.

Why indexing required?

User comes to the site through various search engines and indexing site pages with this search engines are one of the major task during project implementation.

What is SEO?

Search Engine Optimization is the way which the search engine find the content in a website and index it. We need to ensure our site pages are SEO friendly by following SEO Guidelines. Every search engines like Google, Bing, Yahoo, DuckDuckGo having their own bots to crawl the site content.

This post is written considering the users are having a basic understanding about SEO technology.

Why SPA is not readily SEO Friendly?

The advantage of SPA is, they can even update entire pages or part of the page without making another request to the server or even changing the URL. In this case an entire HTML is not getting rendered. AJAX calls are used to load parts of the page using JSON snippets. SEO expects a fully built page for indexing.

Methods to make SPA s SEO Friendly

Below given some of the methods identified to make SPA pages SEO friendly. This solely depends on the usecase too.

Pretty URLs: Never use 'hashes' in URL's. Always go for SEO friendly pretty URL's instead.

Canonical URL's: 
Here a complete duplicate site would be created within the same url to ensure that crawlers would index the site pages properly.

Pre-rendering: In this scenario, we can run the app before deploying it, capture the page output and replace all HTML files with the captured output. Typically this is achieved with a headless browser (For e.g. Firefox Headless Mode, PhantomJS etc). Pre-rendering is a good choice because there is no additional server load, and therefore faster and cheaper than server side rendering.

Server-Side Rendering (SSR): In this case, pages that display constantly changing data which must be loaded dynamically at load time, or for pages that have user-specific content. Note here, Server hosting the website should have Node enabled to implement server side rendering.

HTML pushState: HTML 5 provides a History API called 'Push State'. The pushState method takes three arguments, a data 'state' object, a 'title' string, and a 'url'. When the pushState method is called, the url which is passed to it will appear in the browsers url window. This method can be used as an alternate indexing options for the SPA pages.


What are all the new features of AEM 6.5?

Below given the further details about new features.
 
AEM 6.5 Site related new features

AEM 6.5 Specific new features in Assets section

New Features in AEM 6.5 Forms

Foundation updates in AEM 6.5 which a developer should be aware of

Cloud Manager for AEM 6.5 New features

Tuesday 13 November 2018

Single Page Applications and AEM

What is Single Page Application and its uses?
Single Page Applications (SPAs) are a wonderful tool for making engaging and unique experiences for website users. SPAs helps to build a fluid, scalable experience. SPA can be used within AEM to give both developers and marketers the level of control they need while authoring a content.

Some examples where SPA in use are Gmail, Google Maps, AirBNB, Netflix, etc.

The core principle of an SPA is that it is a single page where a lot of information remains the same and only a few pieces gets updated at a time. This is different from a traditional HTML page load where the server re-renders a full page with every request.

SPAs provide great ease to developers because of the separation of back-end services and front-end display without disturbing critical back-end functionality.  Developers have the option to work in the language they prefer.
  • Common SPA frameworks are Angular, React, Ember, and Vue are JavaScript

Click on image to see it big

Advantages of SPA's

• Behaves like a native application
• Provides rich user experiences
• Good separation of concerns
• API-based
• Decouples content from presentation
• Can provide live preview & editing
• Supports a hybrid setup
• Personalization on the server side

AEM & SPA
The latest versions of AEM supports SPA and allows authoring through SPA Editor.

AEM SPA Editor Steps
Below given sequence of activities involved in AEM SPA websites.

1. SPA Editor loads.
2. SPA is loaded in a separated frame.
3. SPA requests JSON content and renders components client-side.
4. SPA Editor detects rendered components and generates overlays.
5. Author clicks overlay, displaying the component’s edit toolbar.
6. SPA Editor persists edits with a POST request to the server.
7. SPA Editor requests updated JSON to the SPA Editor, which is sent to the SPA with a DOM Event.
8. SPA re-renders the concerned component, updating its DOM.

We are coming up with more blogs/ videos on working with SPAs now.

Read More:


SPA Vs PWA - Single Page Application Vs Progressive Web Apps

AEM Experience Fragments vs Content Fragments

Single Page Applications and AEM
 


What next?

Watch below video to understand basics of SPA.