@@ -6,6 +6,7 @@ const pages = (await getCollection('pages')).filter((entry) => !entry.data.draft
66const homePage = pages .find ((entry ) => entry .data .wordpressId === 156 || entry .data .path === ' /the-hichee-blog/' );
77
88const legacyHomeHtml = homePage ? rewriteHomeHtml (homePage .body ) : ' ' ;
9+ const homeShareHtml = buildHomeShareHtml (homePage ?.data .title ?? ' The HiChee Blog' );
910
1011function rewriteHomeHtml(body : string ): string {
1112 const hrefPattern = / href=(["'] )https? :\/\/ blog\. hichee\. com([^ "'] * )\1 / gi ;
@@ -31,14 +32,36 @@ function rewriteInternalHref(pathValue: string): string | null {
3132 const withLeadingSlash = withoutQuery .startsWith (' /' ) ? withoutQuery : ` /${withoutQuery } ` ;
3233 return withLeadingSlash .endsWith (' /' ) ? withLeadingSlash : ` ${withLeadingSlash }/ ` ;
3334}
35+
36+ function buildHomeShareHtml(title : string ): string {
37+ const shareUrl = ' https://blog.hichee.com/' ;
38+ const linkUrl = encodeURIComponent (shareUrl );
39+ const linkName = encodeURIComponent (title );
40+ const escapedTitle = title .replace (/ &/ g , ' &' ).replace (/ "/ g , ' "' );
41+ const channels = [
42+ { channel: ' facebook' , label: ' Facebook' },
43+ { channel: ' twitter' , label: ' Twitter' },
44+ { channel: ' pinterest' , label: ' Pinterest' },
45+ { channel: ' whatsapp' , label: ' WhatsApp' },
46+ { channel: ' email' , label: ' Email' }
47+ ];
48+
49+ const socialLinks = channels
50+ .map (
51+ (item ) =>
52+ ` <a class="a2a_button_${item .channel }" href="https://www.addtoany.com/add_to/${item .channel }?linkurl=${linkUrl }&linkname=${linkName }" title="${item .label }" rel="nofollow noopener" target="_blank"></a> `
53+ )
54+ .join (' ' );
55+
56+ return ` <div class="addtoany_share_save_container addtoany_content addtoany_content_bottom"><div class="a2a_kit a2a_kit_size_32 addtoany_list" data-a2a-url="${shareUrl }" data-a2a-title="${escapedTitle }">${socialLinks }<a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share"></a></div></div> ` ;
57+ }
3458---
3559
3660<BaseLayout
3761 title =" The HiChee Blog and Travel Guide"
3862 description =" Insider travel tips and destination guides from HiChee."
3963 canonical =" /"
4064 bodyClass =" legacy-home home wp-theme-kadence wp-custom-logo"
41- suppressFooter ={ true }
4265>
4366 <Fragment slot =" head" >
4467 <link rel =" stylesheet" href =" /wp-legacy/wp-block-library.min.css" />
@@ -55,7 +78,10 @@ function rewriteInternalHref(pathValue: string): string | null {
5578
5679 {
5780 homePage ? (
58- <article class = " legacy-home-content" set :html = { legacyHomeHtml } />
81+ <article class = " legacy-home-content" >
82+ <Fragment set :html = { legacyHomeHtml } />
83+ <Fragment set :html = { homeShareHtml } />
84+ </article >
5985 ) : (
6086 <section class = " listing-hero" >
6187 <p class = " eyebrow" >Missing Source</p >
0 commit comments