ក្នុង​ការផ្តល់លទ្ធភាព​អោយ​អ្នក​អាន​អាច​ធ្វើការ​អធិប្បាយ​ផ្សេង​ៗ​ទៅ​លើ​ការផ្សាយ​នានា ដែល​ភាសា​អង់គ្លេស​ហៅ​ថា comment យើង​អាច​បញ្ចូល​ផ្ទាំង​សំរាប់ធ្វើ​បទ​អធិប្បាយ​របស់​ក្រុមហ៊ុន Meta ឬ Facebook ។ លើស​ពី​នេះ​ទៀត យើង​ក៏​អាច​ប្រើប្រាស់​រូប​ចែក​រំលែក​ (share) របស់​ក្រុមហ៊ុន​ Facebook បាន​ដែរ ដោយ​ចំលង​យក​កូដ​ពី​គេហទំព័រ​របស់​ក្រុមហ៊ុន​​​​​​នេះ​ នៅ​ត្រង់​អាស័យដ្ឋាន https://developers.facebook.com/docs/plugins/comments/ និង​មួយ​នេះ https://developers.facebook.com/docs/plugins/share-button/

 

<div class="fb-share-button" data-href=`https://khmerweb-static-blog.netlify.app/post/${post.slug}` data-layout="" data-size="">
    <a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fkhmerweb-static-blog.netlify.app%2F&amp;src=sdkpreparse" class="fb-xfbml-parse-ignore">Share</a>
</div>
<div class="fb-comments" data-href=`https://khmerweb-static-blog.netlify.app/post/${post.slug}` data-width="100%" data-numposts="5"></div>

 

ជា​លទ្ធផល គំរូ​ទំព័រ​ការផ្សាយ​មានទំរង់​ដូច​ខាង​ក្រោម​នេះ៖

 

<!--src/layouts/Post.astro-->
---
import { getEntry } from 'astro:content'
const { post } = Astro.props
const { Content } = await post.render()
const author = await getEntry(post.data.author)
const videos = await getEntry(post.data.videos)
---
<section class="Ad region">
    <img src="/images/ad.jpg" />
    <img src="/images/ad.jpg" />
</section>

<div id="fb-root"></div>
<script is:inline async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v14.0&appId=3245867309046703&autoLogAppEvents=1" nonce="uHaMaoD7"></script>

<section class="Post region">
    <div class="main">
        <h3 class="title">{post.data.title}</h3>
        <div class="categories">
            <span>​​​​​​​​​ជំពូកៈ {post.data.categories.join(', ')}</span>
            <span>{post.data.pudate.toLocaleDateString('it-IT')}</span>
        </div>
        <div class="author">
            <span>អ្នក​​​​​​​​​​រៀបរៀងៈ {author.data.name}</span>
        </div>
        <div class="video" data-videos={JSON.stringify(videos?.data.videos)}>
            <div class="screen"></div>
            <div class="playlist" data-title={post.data.title}></div>
        </div>
        <script is:inline src="/scripts/setplayer.js"></script>
        <script is:inline>         
            let clicked = 0
            let rawVideos = $('.Post .main .video').attr('data-videos')
            const title = $('.Post .main .video .playlist').attr('data-title')
            
            const videos = JSON.parse(rawVideos)
            
            for(let index in videos){
                let ending = ''
                if(index == videos.length-1){
                    ending = videos[index].status
                }
                
                let result = `<div id="part${index}" class="part" onClick="setScreen(videos[${index}], ${index},true)">${title} part ${(++index)} ${ending}</div>`
                
                $('.playlist').append(result)
            }
            setScreen(videos[0],0,false)
        </script>
        <div class="content"><Content/></div>
        <div class="fb-share-button" data-href=`https://khmerweb-static-blog.netlify.app/post/${post.slug}` data-layout="" data-size=""><a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fkhmerweb-static-blog.netlify.app%2F&amp;src=sdkpreparse" class="fb-xfbml-parse-ignore">Share</a></div>
        <div class="fb-comments" data-href=`https://khmerweb-static-blog.netlify.app/post/${post.slug}` data-width="100%" data-numposts="5"></div>
    </div>
    <div class="sidebar">
        ផ្សាយ​ពាណិជ្ជកម្ម
    </div>

</section>

<style is:global>
.Ad{
    display: grid;
    grid-template-columns: repeat(2, auto);
    grid-gap: 10px;
}
.Ad img{
    width: 100%;
}
.Post{
    margin-top: 20px;
    display: grid;
    grid-template-columns: 70% auto;
    grid-gap: 15px;
}
.Post .main, .Post .sidebar{
    background-color: rgb(231, 223, 223);
    color: rgb(22, 22, 22);
    padding: 15px;
}
.Post .sidebar{
    text-align: center;
    padding: 0;
}
.Post .main .title{
    font: 18px/1.5 Oswald, Koulen;
    margin-bottom: 20px;
}
.Post .main .categories span:nth-child(2){
    float: right;
}
.Post .main .author{
    margin-bottom: 30px;
}
.Post .main .video .screen div{
    position: relative;
    padding-top: 56.25%;
    border: 1px solid white;
    border-bottom: none;
}
.Post .main .video .screen div iframe{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
.Post .main .video .playlist{
    max-height: 405px;
    overflow: auto;
    margin-bottom: 20px;
    border: 1px solid white;
}
.Post .main .video .playlist .part{
    text-align: left;
    padding: 10px;
    color: var(--color);
    display: block;
    height: auto;
    font-size: 16px;
    background: var(--body);
    border: 1px solid white;
    border-top: none;
}
.Post .main .video .playlist .part:last-child{
    margin-bottom: 0;
}
.Post .main .video .playlist .part:hover{
    cursor: pointer;
    opacity: .7;
}

@media only screen and (max-width:600px){
    .Ad{
        grid-template-columns: 100%;
    }
    .Post{
        grid-template-columns: 100%;
    }
}
</style>

 

Netlify: https://khmerweb-static-blog.netlify.app

GitHub: https://github.com/Sokhavuth/static-blog