Closed data-datum closed 4 years ago
Easy:
Create a custom template file layouts/partials/widget_medium.html
with your above code as the content. For completeness,
<div id="medium-widget"></div>
<script src="https://medium-widget.pixelpoint.io/widget.js"></script>
<script>
MediumWidget.Init(
{
renderTo: '#medium-widget',
params: {
"resource": "https://medium.com/@data_datum",
"postsPerLine": 1,
"limit": 4,
"picture": "small",
"fields": ["description", "author", "claps", "publishAt"],
"ratio": "square"}
}
)
</script>
Put {{ partial "widget_medium.html" . }}
into the template file where you want it to appear. For example, layouts/_default/single.html
is for the post, etc.
Try it out, if you can't get it to work, then bring your repo back here and I'll try to help.
I was not ablet to do it. Here is my repo https://github.com/data-datum/rnv-cv
Well, the Academic theme is much complicated than I thought, so my PR above took another path.
In summary:
I Tested and worked on my local machine, please have a look.
Also, don't forget to delete the layouts/partials/widget_medium.html
under your content/
directory
A note:
This is still a bit hacky because the medium account info is hard-coded in the shortcode template. A better way to achieve this might be set up some kind of site parameters in config.toml
file
I would like to know how to have a widget to share my Medium posts in blogdown. I have this code
`
but I do not know how to share this in my personal profile with blogdown