original Script generated using GISCUS

Be sure To Change Parameter value Based on you Generation from here https://giscus.app/

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
<script src="https://giscus.app/client.js"
        data-repo="PrashantUnity/GettingStarted"
        data-repo-id="R_kgDOKzC5Hw"
        data-category="General"
        data-category-id="DIC_kwDOKzC5H84CdPDh"
        data-mapping="specific"
        data-term=" GettingStarted Discussions"
        data-strict="0"
        data-reactions-enabled="1"
        data-emit-metadata="0"
        data-input-position="top"
        data-theme="light"
        data-lang="en"
        data-loading="lazy"
        crossorigin="anonymous"
        async>
</script>

Above Code is Coverted to be usable in Blazor

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
@using Microsoft.AspNetCore.Components

@if (Script != null)
{
    <div>
        @Script
    </div>
}

@code {

    #region Parameter
    // change only commented section
    [Parameter]
    public string InputPosition { get; set; } = "top"; 
    [Parameter]
    public string Term { get; set; } = "GettingStarted Discussions"; // name anything it will create one one discussion based on name
    [Parameter]
    public string Repo { get; set; } = "PrashantUnity/GettingStarted"; // your repository name
    [Parameter]
    public string RepoId { get; set; } = "R_kgDOKzC5Hw"; //  this is generated by giscus website only one time creation required for one repo
    #endregion

    
    public string Category { get; set; } = "General"; 
    public string CategoryId { get; set; } = "DIC_kwDOKzC5H84CdPDh";  //  this is generateeed by giscus website only one time creation required for one repo
    public string Mapping { get; set; } = "specific"; 
    public bool ReactionsEnabled { get; set; } = true; 
    public string Theme { get; set; } = "light"; 
    public string Language { get; set; } = "en"; 
    public string Loading { get; set; } = "lazy"; 
    public string EmitMetadata { get; set; } = "0"; 
    public string Strict { get; set; } = "0";

    private RenderFragment Script { get; set; }

    protected override void OnParametersSet()
    {
        Script = new RenderFragment(b =>
        {
            b.OpenElement(0, "script");
            b.AddMultipleAttributes(1, new List<KeyValuePair<string, object>>()
                {
                    new KeyValuePair<string, object>("src", "https://giscus.app/client.js"),
                    new KeyValuePair<string, object>("data-repo", Repo),
                    new KeyValuePair<string, object>("data-repo-id", RepoId),
                    new KeyValuePair<string, object>("data-category", Category),
                    new KeyValuePair<string, object>("data-category-id", CategoryId),
                    new KeyValuePair<string, object>("data-mapping", Mapping),
                    new KeyValuePair<string, object>("data-term", Term),
                    new KeyValuePair<string, object>("data-strict", Strict),
                    new KeyValuePair<string, object>("data-reactions-enabled", ReactionsEnabled ? "1" : "0"),
                    new KeyValuePair<string, object>("data-emit-metadata", EmitMetadata),
                    new KeyValuePair<string, object>("data-input-position", InputPosition),
                    new KeyValuePair<string, object>("data-theme", Theme),
                    new KeyValuePair<string, object>("data-lang", Language),
                    new KeyValuePair<string, object>("data-loading", Loading),
                    new KeyValuePair<string, object>("crossorigin", "anonymous"),
                    new KeyValuePair<string, object>("async", true),
                });
            b.CloseElement();
        });
    }
}

Uses

1
<GiscusIntegration />