CSS supports media queries since Level 2, Revision 1. That's from way back in 2011, so any modern web browser should support it.
If you're able to specify custom CSS, and apply custom CSS classes to your content, then you can define a CSS class such that the pictures and other ancilliary content is shown on screen, but only the actual recipe is printed on paper.
This way, you don't need to have a separate "printer friendly" page, because you're using CSS to define what "printer friendly" means for your particular content. Of course, it assumes that you have control over the CSS in the first place! The person visiting your web site just prints via their browser's normal "print" function.
Specifically, as discussed on MDN, you can either target print
media, or a specific characteristic of a media (a feature). For the former, you'd add something like
@media print {
img.food-photo { display: none; }
body { color: black; }
}
to hide food-photo
class img
s and set the text color to black
when the rendering media is identified as print
.
For the latter, you can target non-color-capable media (whether screen, print, or otherwise) by writing something like
@media not color /* untested, but looks like it should work */ {
body { color: black; }
}
to set the text color to black
where color is not supported.
These can be combined to form even more complex rules, and of course the normal CSS inheritance rules apply as well, so you can override only those attributes that need to be different between, say, print and non-print.
You might also be interested in CSS feature queries, which look to be similar but geared toward even more specific feature support; for example, one example shows how to apply specific CSS depending on whether display: flex
is supported. This looks more useful for when you want to know that the user agent (browser) supports a feature, than for targetting specific media types or capabilities.
I came across a Stack Overflow question at What does @media screen and (max-width: 1024px) mean in CSS? which has some more complex examples that you may find enlightening.
I think that the biggest downside to using CSS for this is that it leaves the visitor with no easy way to print the whole page including the "narrative/journey" if that's what they want to do. There are tricks that one can use, but those by their very nature are rather technical.