Change the value of instance to the domain name of your Mastodon instance, change the value of userId to your number id, and at last remove staticStatusesDataPath. Save and refresh your page, and you can see your toots was shown in the widget.
Open your Mastodon timeline in browser, and click your avatar, then look at address bar you can find the url is <instance domain>/web/accounts/<number>, the <number> is your number id.
Not using iframe
If you don't want to use iframe, you can import default.style.css and mastodon-on-blog.js to your page:
then insert this HTML code to where you want the widget is rendered:
<div id="my-mastodon-widget"></div>
at last insert the config code at the bottom of your page:
MastodonOnBlog({
instance: '',
userId: 1,
...
})
Status code: 401
if you get the message "Status code: 401" in your widget, there are two possibilities:
Your instance is in whitelist mode;
The version of your instance is older than 2.7.0
Under all of status above, your should use a read:statusestoken to fetch your toots:
MastodonOnBlog({
...
token: 'your token'
})
RISK WARNING:
The token will expose all your toots, including your private toots like what follower-only or someone-only.
Set your access token
Enter <instance domain>/settings/applications/new, fill an application name (whatever you like), only check read:statuses and uncheck all others options, then click submit button. Open the application page you just created, you can find the access token (你的访问令牌 in Chinese).
请发表评论