Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline telegram script #433

Merged
merged 3 commits into from
May 24, 2022
Merged

Inline telegram script #433

merged 3 commits into from
May 24, 2022

Conversation

Matt-Esch
Copy link
Contributor

I am trying to use the telegram comment widget. The widget inserts an iframe to the parent of the script node. Because scripts are appended to the end of the page, this ends up being the body and not the comments placeholder. I had to inline the script within the comments placeholder manually like this to get the comments to show in the right place.

You might have a better idea for how to do this (maybe using the scripts partial or something like that, I'm new to this templating system), but this is the expected result I'm looking for.

Copy link
Contributor

@khusika khusika left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest is looks good to me, telegram widget will spawn following the script that called it

Without this patch

<div id="comments">
    <div id="telegram-comments" class="comment"></div>
    <noscript> Please enable JavaScript to view the comments powered by <a href="https://comments.app/">Telegram Comments</a>. </noscript>
</div>

With this patch

<div id="comments">
    <div id="telegram-comments" class="comment">
        <script type="text/javascript" src="https://comments.app/js/widget.js?3" data-comments-app-website="Mvf_8EPT" data-limit="5" data-colorful="1" data-dislikes="1"></script>
        <noscript> Please enable JavaScript to view the comments powered by <a href="https://comments.app/">Telegram Comments</a>. </noscript>
    </div>
</div>

@@ -95,10 +95,11 @@
{{- if $telegram.outlined -}}
{{- $attr = printf `%v data-outlined="1"` $attr -}}
{{- end -}}
{{- dict "Source" "https://comments.app/js/widget.js?2" "Defer" true "Attr" $attr | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
<script type="text/javascript" src="https://comments.app/js/widget.js?3" {{ with $attr }} {{ . | safeHTMLAttr }}{{ end }}></script>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you don't need to remove defer attribute. It make main page page load earlier as the script is executed when the page has finished parsing.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you don't need to remove defer attribute. It make main page page load earlier as the script is executed when the page has finished parsing.

Thank you very much for this fix, I see you marked in my PR, but this is not your template, the developer has abandoned this project?

@OrvilleQ
Copy link

Angthing new about this fix?

@khusika
Copy link
Contributor

khusika commented Jul 10, 2020

Angthing new about this fix?

You can apply this commit into your personal repo if you want.

@uPagge
Copy link

uPagge commented Dec 6, 2020

This change I moved to the new fork 😄

Since the developer has unfortunately abandoned the project 😞, I would like to take responsibility for its support and development in the future.

🔗 -> https://github.com/uPagge/uBlogger.

I focused on adding new features, refreshed the design of the posts, fixed the bugs I found.
There were so many changes (the ability to choose a separate design for the post, breadcrumbs, a new comment system and much more), and so much to do, that I decided to give the template a new name uBlogger.

Short and basic, what I have changed

I will be glad if you look at it, you may like the updated design.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@dillonzq dillonzq merged commit a731498 into dillonzq:master May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants