Embed Motoko
Overview
The Embed Motoko tool enables Motoko smart contracts to be embedded in web pages such as a blog, web application, or even a Medium article. Simply insert your Motoko smart contract into the Embed Motoko tool and copy either the generated embedded URL or the HTML iframe to use in your web page.
Simple example
Navigate to the Embed Motoko web-based tool.
Insert your Motoko code into the web-based code editor. This example uses a simple 'Hello world!' example.
To get the embedded URL for this smart contract, click on the link icon in the top right corner:
The console output on the page will confirm that the embedded URL has been copied to your clipboard. The embedded URL will resemble the following:
https://embed.smartcontracts.org/motoko/g/RnWsYTzKuWEyzDDgFaFBJvYjkiAvqAQvqFBrkv4HLUUBkAQQSTWHz8NneJy4cRbJgS6NToPXdZxYo1YDGry7NDR9kYcFspuLMSNkXggQZMyB17YhUkMvYNp4HSF3Hoxewg4C8skNyaNhVhtifvKm3WypBcogAXJEccqQEAVz?lines=10
You can also get the HTML iframe code by clicking on the </>
icon in the top right corner:
The console output on the page will confirm that the iframe code has been copied. The iframe will resemble the following:
<iframe src="https://embed.smartcontracts.org/motoko/g/RnWsYTzKuWEyzDDgFaFBJvYjkiAvqAQvqFBrkv4HLUUBkAQQSTWHz8NneJy4cRbJgS6NToPXdZxYo1YDGry7NDR9kYcFspuLMSNkXggQZMyB17YhUkMvYNp4HSF3Hoxewg4C8skNyaNhVhtifvKm3WypBcogAXJEccqQEAVz?lines=10" width="100%" height="360" style="border:0" title="Motoko code snippet" />