Welcome to my personal website. I use this space to share some of my thoughts and software that I write in my free time. Sometimes I also publish photos. If you want to get in touch please use LinkedIn or Mastodon.
One of the things that I like about Twitter is that the font size changes depending on the length of the tweet. Yesterday, I tried to achieve the same thing for this Jekyll based blog and came up with the following solution.
First, I created a plugin (in the folder _plugins) and registered it as Liquid filter with the following code:
As a next step I changed the post.html template to this:
It is important to remove the <p> tags because they cannot be nested in valid HTML and Jekyll adds their own tags to post content.
Finally, I created some SCSS to change the font-size based on the CSS class.
About the author
Friedrich Ewald is an experienced Software Engineer with a Master's degree in Computer Science. He started this website in late 2015, mostly as a digital business card. He is interested in Go, Python, Ruby, SQL- and NoSQL-databases, machine learning and AI and is experienced in building scalable, distributed systems and micro-services at multiple larger and smaller companies.