SmartBlocks
SmartBlocks copied to clipboard
Search YouGlish using Page Title as a default input
✂️ Copy of your #42SmartBlock from Roam
-
#42SmartBlock YouGlish
-
:hiccup [:a#yg-widget-0.youglish-widget {:data-query <%J: ```javascript return "\"" + encodeURIComponent(prompt('Enter words to lookup in YouTube.', document.title)) +"\"" ; ``` %>} "YouGlish"]
-
<%NOBLOCKOUTPUT%><%JA: ```javascript var s = document.createElement('script') s.type = "text/javascript" s.src = "https://youglish.com/public/emb/widget.js" document.getElementsByTagName('head')[0].appendChild(s) return '';``` %>
-
<%CURSOR%>
-
📋 Describe the SmartBlock
YouGlish is a popular service among English language learners to search usage of words or phrases in YouTube videos. This SmartBlock searches YouGlish's database with a page title as a default input and embeds the search result into Roam.
✅ Describe any prerequisites or dependencies that are required for this SmartBlock
None. This is an attempt to simulate YouGlish widget. Widget details can be found in YouGlish's site. If you find a better way of implementing the widget, please share it in the comment.
📷 Screenshot of your #42SmartBlock workflow/template from Roam
💡 Additional Info

Why does it become like a link and not activate again after exiting it once? with exiting I mean closing the parent block
one more thing, how can I use it with youglish for german?
![]()
Why does it become like a link and not activate again after exiting it once? with exiting I mean closing the parent block
Make another SmartBlock with the following two blocks in it. Let's name it as YouGlish2. When you revisit the page and want to see the YouGlish widget again, run "YouGlish2". Hope it helps.
Do you mean repeat the Youglish Smartblock like this?
Sorry~~ I understand what you mean now thanks~
I have made a small change and added an activate button to the bottom of the widget.
Button code:
{{Activate:42SmartBlock:YouGlish Reactivate:42RemoveButton=false}}