Monday, November 28, 2022

What is Sitemap?

 

What is Sitemap?


An XML sitemap helps search engines easily navigate through your website content. It gives them a list of all your content in a machine-readable format.


An XML sitemap is a file that lists all your website content in an XML format, so search engines like Google can easily discover and index your content.

Today sitemaps are published in an XML format instead of HTML, and their target audience is search engines and not people.

Basically, an XML sitemap is a way for website owners to tell search engines about all the pages that exist on their website.

Below is example of sitemap: https://www.google.com/photos/sitemap.xml


https://www.google.com/photos/sitemap.xml



example:

<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>https://www.google.com/intl/nl_nl/photos/printing/photo-books/</loc> <lastmod>2022-01-01</lastmod> </url> </urlset>

It consists of a below parts:

  • An XML version declaration: which search engine crawlers use to determine what type of file they are reading.
  • The URL set: tells search engines about the protocol.
  • The URL: lists the URL of the page.
  • Lastmod: a date format describing when the page was last modified.

Why we need Sitemap?

  • Sitemaps are extremely important from a search engine optimization (SEO) point of view.
  • Simply adding a sitemap does not affect search rankings. 
  • Sitemaps are equally as important for established popular websites as well. They allow you to highlight which part of your websites are more important, which parts are more frequently updated, etc, so search engines can visit and index your content accordingly.
Hope this helps!

How to create sitemap scheduler in AEM as cloud refer here.

SITEMAP | AEMaaCS

 


In this blog we can see how we can use Sitemap Scheduler approach in AEMaaCs to generate the sitemap.

As we need the Scheduler sitemap generation in publish mode we will go ahead and create a OSGI configuration in config.publish in our code repo.

 

Create file cfg.json under config.publish to define the scheduler job for Sitemap (org.apache.sling.sitemap.impl.SitemapScheduler~myproject.cfg.json)


org.apache.sling.sitemap.impl.SitemapScheduler



What is sitemap? Refer here


Sunday, November 27, 2022

Sling RepoInit: Tool to Manage Content and Users in AEM | AEMaaCS

Setting up the initial state of AEM repository may appear cumbersome, we need to do lot of configurations and create system users and provide access to specific paths. Below are some of the items:

  • Creating service users
  • Creating user groups
  • Setting up ACLs/permissions for these users
  • Base content structure inside /conf or /content

Creating and setting up these configurations manually may lead to mistakes, and we have lot of environments development, QA, stage, prod etc. To overcome all these issues, Apache Sling Repository Initialization comes very handy.

 

How Repo Init works?

Repo Init is a set of instructions/scripts which help us in creating JCR structures, service users and groups. There are no explicit permissions needed in order to run these scripts. These scripts are executed early in the deployment process so that all required configuration/content exist in the system before the code is executed.

 

Configuring Repo Init:

To enable Repoinit, OSGi configuration for factory PID org.apache.sling.jcr.repoinit.RepositoryInitializer in one of the project’s configuration folders. Since it’s an OSGi configuration, it is easy to have a set of scripts for author and publish run modes, along with different environments such as Stage and Production. For example, config.author, config.publish, config.author.prod, and config.publish.stage, etc. use a descriptive name for the configuration like org.apache.sling.jcr.repoinit.RepositoryInitializer~init and config should be like”

 

org.apache.sling.jcr.repoinit.RepositoryInitializer-myprojectinit.config

 

These configurations have two optional fields:

·       A multi-value references field with each value providing the URL (as a String) of raw Repoinit statements

·       A multi-value scripts field with each value providing Repoinit statements as plain text in a String



Let’s create service user and provide some permissions:

scripts = “[

create service user my-service-user,

create path /conf/demo(nt:folder)/myconfig(sling:Folder),

set ACL for my-service-user;

allow jcr:read,rep:write on /conf/demo/myconfig;

end

]”

 It will create "my-service-user" system user and provide read & write permission to this user of path /conf/demo/myconfig.


Create service user user-1, user-2


scripts = “[

set ACL on /content/dam
    allow jcr:read for user-1,user-2
end

]”

  Service User – permission to multiple paths

    set ACL on /content/dam/myproject, /conf/myproject

         allow jcr:all for user-1

    end

"]

References:
https://sling.apache.org/documentation/bundles/repository-initialization.html

Happy Learning!

Install yarn on windows

 In this article, we will see how we can install yarn on windows. First lets understand what yarn is? Yarn is an established open-source pac...