whenever an author authors the sling vanity property for a particular page under site A, I want to append /siteA/ as a prefix to the value stored, similarly when an author authors vanity property under siteB, I need to append /siteB/ as a prefix to the value stored. I came to know what we can achieve it using vanity-root tenant conf but could not find any documentation anywhere.
You can write a helper class using wcmuse or sling model and add it to your base template. So, whenever the author edits the vanity Url and saves the page, the request goes to the helper class. In helper class, you can read the value of vanity Url, append Sitename as prefix and write it back.