1. 20
  1.  

  2. 4

    For whatever it’s worth: I wrote something vaguely similar a while back, which produced a decent amount of discussion here.

    1. 3

      Do you still need <meta http-equiv="x-ua-compatible" content="ie=edge">? I think this only affects IE10 and earlier, and even in those cases it doesn’t really seem needed if you have <!doctype html>.

      1. 1

        This is a good callout, I’ll remove this now since it’s a remnant of my time building for IE10.

      2. 3

        You don’t need <head> or <body>. If <html> didn’t have a lang tag you wouldn’t need that either. Also, as @arp242 already mentioned, you probably don’t need x-ua-compatible anymore.

        -edit: source (via)

        1. 5

          The goal of this project (which probably isn’t explained well) is to provide a base template to be extended. With that goal in mind, I think it makes sense to include <head> and <body> tags as a placeholder for people to add to. It’s the same reason that the chartset / viewport / description / title tags are included in the head.

          Edit: Seeing your PR is making me ponder this comment a little – but I’m still not sure I’m ready to ditch those wrappers.

          1. 6

            I think your HTML file would be silly if it didn’t include <head> and <body>. If someone is trying to golf every last byte out of their HTML file then fine, but it would be odd to use such a thing as a starting point.

          2. 4

            It’s often been said that the regular expression that matches HTML is simply .*, so realistically speaking you don’t need anything – but that sounds like what an edgy teen who says “you don’t need to do anything but die (… so I won’t do my homework)”.

            1. 2

              unfortunately, if you are developing a plain HTML website and using something like live-server to watch for changes as you edit the file, it needs the <html><body> tags to work properly.

              1. 3

                That’s probably a bug. The DOM won’t look any different if you omit <html><body>, as the tags are implied. I don’t know live-server, but I suppose it looks for these tags to figure out where to inject its auto-reload JS magic?

                (yep, it seems like that’s the problem, and someone made a PR to fix this in 2017, is the project dead?)

            2. 2

              It would be cool if the “delete this” part explained it. I try to avoid cargo-culting.

              1. 3

                It’s not cargo-culting, it’s just telling you to delete the content that’s already there because it assumes you don’t want the original content.

                Although I really don’t see the point of the website, just have a local file with your own version of that or a snippet in your favorite editor and that’s it. I thought there was some trickery with curl being detected server side to serve a page without the content but no…

                1. 2

                  … /s?

                  1. 1

                    No, I mean have it explain the rationale behind the specific meta tags, etc.

                2. 1

                  Are we code golfing html templates now.

                  Here’s mine:

                  
                  

                  0 characters. Any browser will display it just fine. You’re welcome.

                  1. 1

                    Hm I like the idea of having it online, might put up my own … I have to copy this between static files, Python, and now PHP (yes I wrote PHP :) )

                    Here’s one I just made:

                    <!DOCTYPE html>
                    <html>
                      <head>
                        <meta name="viewport" content="width=device-width, initial-scale=1">
                        <title>Hello</title>
                      </head>
                    

                    which I now realize is inconsistent with oilshell.org:

                    <!DOCTYPE html>
                    <html lang=en>
                    <head>
                      <meta charset=utf-8>
                      <meta name="viewport" content="width=device-width, initial-scale=1">
                      <title>Oil</title>
                    </head>
                    
                    • lang=en – does this improve anything? Does it stop Chrome from showing you annoying and incorrect translation pop-ups?
                    • <meta charset=utf-8> – I believe this is better because you don’t always control the web server, and the default Content-Type header does not include UTF-8. So I should add this to my other site.
                    1. 4

                      lang is also used to set hyphenation rules. I believe there are some accessibility considerations for screen reader pronunciation, too.

                    2. 1

                      I think it’s a little unclear where the “delete this” part is supposed to end. (I mean, it’s clear to me, but I do this professionally.) I would suggest adding a blank line before </body> and/or another comment saying “end of the section to delete” or something like that.

                      1. 0

                        Looking forward for an essential.html project with a template for useful tags.