One of the things I love about Hugo is its flexibility when it comes to Markdown rendering. While the default behavior
for images is usually enough, I found myself wanting more control. Specifically the ability to add CSS classes
or wrap images in links without resorting to raw HTML in my Markdown files (as hugo raises warnings about this).
To solve this, I started using a custom render-image.html template. It allows me to stay in “Markdown mode” while
still getting the benefits of optimized, flexible image output.
In the past year I left my position as a Web Developer to work as a Software Developer. Not only did I leave web development behind, the core languages I use every day changed. I switched from a primarily PHP/Javascript developer to a Python/C++ developer. Changing a tech stacks created a need for me to learn a lot about a new language very quickly, I’ve decided to write down some of what I learned.
... ➦As a developer, I want to keep my code as DRY as is feasible for the given project. In a Hugo project, that’s where the Partial templates come in.
Partials are smaller, context-aware components in your list and page templates that can be used economically to keep your templating DRY.
Partials, however, have one serious limitation, they’re cached during the build of a given page (or scope). Once a partial has been created, no outside logic can adjust what the partial returns (for the page). This makes the build very fast. But, prevents modifications to the partial if so desired. Imagine a scenario where a partial defines a DOM ID and you want to include the partial twice on the page. In that scenario you’ll end up with a duplicated id on the page.
... ➦Making sure webistes are accessible is a big deal these days. Websites should be mindful of their audience to make sure people with disabilities are not excluded from the site content. Color contrasts between foregrounds and backgrounds is an easy miss when checking that a site is accessible, but one that is vital to hard of sight users.
... ➦eZ Platform boils down to a set of Symfony bundles that give you a nice way of managing content for your users. With these bundles, eZ reserves some routing paths for internal or admin use, paths that you might want for your own app. If you ever run across a path you want to use for your app, and not break an internal eZ feature, there is a simple solution: change the path config.
... ➦Managing media in an eZ Publish 4 install was always a pain point for me. There were a number of problems that I had with media in eZ Publish 4 that are now addressed thanks to Symfony. The media I am referring to in this post are any content types placed in the media category, traditionally images, files, audio files, and video files.
... ➦KNP Menu is a library by the guys at KNP Labs for building menus with php. The KNP menu library offers great features like automatically adding branch classes, marking the first and last item in a menu, and provides features for to automatically figure out the current menu item. Adding raw html into a label (eg <br>) can be a bit of a pain, however.
I enjoy being a PHP Developer. PHP is a very flexible language and Symfony2 is a modern framework that forces many SOLID habits on developers. I also enjoy working with AngularJS. AngularJS makes Javascript fun and much easier to work with. Moreover, much like Symfony2, it forces good habits on developers. Getting the two to work together, however, can be a little bit of a chore if not careful.
... ➦One of my favorite features of Ruby on Rails is that all models are timestamped by default. Ruby on Rails, of course, opts for convention over configuration. Symfony2, on the other hand, opts for configuration over convention. Anyone who has worked with Symfony2 can speak to the mass of config files that exist in a project. I can understand, therefore, why timestamped models (entities) are not a feature in Symfony2. In this post I will show how to add timestamp all your Symfony2 entities. For this post, I chose to use Doctrine as my ORM, so all code show directly relates to Doctrine and Symfony2.
... ➦