import { useSiteMetadata } from "./use-site-metadata";

export const useEmailLink = (titolo: string, relativeDirectory: string) => {
  const email = useSiteMetadata().siteMetadata.email;
  const siteUrl = useSiteMetadata().siteMetadata.siteUrl;
  const path =
    relativeDirectory.indexOf("/") == 0
      ? relativeDirectory.substring(1)
      : relativeDirectory;
  return `mailto:${email}?subject=${titolo}&body=%0D%0A%0D%0A%0D%0A%0D%0A${siteUrl}/${path}`;
};
