7 ms·
Writing HTML in HTML (2019)
- dj_mc_merlin 6y agoOr just write your own static site generator. For extra fun, before you begin, browse random blogs and take a drink whenever the first post is about how they built the static site generator for their blog.
- davemp 6y agoI agree. Writing a static site generator can be very easy to do. I just use pandoc, a makefile, and a tiny python script to insert articles into the index. Stay tuned for my blog post.
- chownie 6y agoIf I'm wanting to write about something I want to write about that thing, not write about that thing in the midst of a bunch of extraneous fluff like header tags, script tags, CSS, etc. The author's thoughts about layers of indirection are confusing to me, I'd actually take the comparison the other way. If I'm not using markdown plus a static site generator now I have to keep track of things like layout, styling, script tags, etc myself plus the actual writing I was intending on doing. I used to have an extremely simple markdown server. It presented 2 types of page, an index and an article. The index simply read the /content directory on the server. Requesting any file under /content would render the markdown into the article page and affix a date and time from the .md file's metadata. Takes <1 hour setup and means you never have to copy and paste random files or do whole site page transformations (as the author has admitted to in that very post) to clean your mishmash HTML beast.
- arkitaip 6y agoThe author suggests using a visual html editor and copying any code you need for layout, navigation, etc. You can't deny that's infinitely easier than rolling your own SSG and using markdown.
- chownie 6y agoAh, well in that case the note about layers of abstraction don't really apply very well. A full WYSIW(YG/YM) editor is not going to generate HTML you actually want to read or write. Otherwise we'd all be making sites in Microsoft Word given its ubiquity! :D
- nix0n 6y agoThe HTML that is generated by Seamonkey Composer is reasonably editable as plain source. (Actually it is much more pleasant than using exclusively Notepad, because the auto-indentation is reasonable.) However, Microsoft Word generates extremely bad HTML. Don't use it.
- dsego 6y agoLike the div soup react (or any other js framework) generates is any better. In any case, I don't understand the need for clean HTML if I don't have to read or write it. Which is supposedly true if I'm going to be using a wysiwyg editor or you know a web browser to read the actual content of the damn page and not its markup.
- mro_name 6y ago> I used to have what happened to it?
- chownie 6y agoThis was several years ago now, during my pre-university days. I lost access to my hosting and my domain due to lack of funds, dead hard drives (didn't use any versioning) etc. At this point I don't write about much, so I haven't revived it.
- KMnO4 6y agoI’m having trouble telling if this is satire, but I think it’s not. The arguments are fairly weak, notably: 1. Using a static site generator, you have to keep track of the source code and the build (which the author suggests is more “source code”) Nope. I could look at the dozen or so static sites sitting on my hard drive — I’ve kept none of the build directories. I simply git push the source and Netlify takes care of managing everything else. 2. > Let's say you want your site to have a specific directory structure, where pages are sorted under various categories. With Jekyll, this is practically impossible Again, I don’t agree that this is even an issue, but there’s also nothing stopping you from using whatever directory structure you want. I don’t use Jekyll much, but that’s the thing about SSG: you can use the one that’s as simple or as complicated as you’d like! You could even generate your site with a simple bash script: for p in in/*.html; do cat common/header.html in/$p common/footer.html > out/$p; done As you can see there’s very little stopping you from preserving whatever structure you want. In fact, the author even suggests this! >If you find the previous step too much work, write a shell script that copies the directory and removes the old content for you. Okay, so if you already have a script that copies content, you basically have a very bad manual SSG that doesn’t keep everything in sync. I don’t really think any of this is easier than just spending the afternoon figuring out a basic SSG.
- mro_name 6y ago> and XYZ takes care of managing everything else. that's external dependencies. I guess that's a nogo for the author.
- xwolfi 6y agoYou spend the afternoon doing this, then a few more to make it "generic" then it's dozens of your successors swearing at you for doing something so complex to solve a problem so simple.
- vehemenz 6y agoI don't think it's satire. You're suggesting an SSG, Git, Netlify, and shell scripts. Is this really easier than HTML files on a server? I can do everything with HTML files, and if I need templating I can just use PHP.
- tannhaeuser 6y agoI agree a lot with the post, but using a WYSIWYG editor isn't really writing HTML is it? You can write HTML in your text editor, get piecemeal automation as you go such as sharing a common site menu or other boilerplate via text variable substitution, generate a table-of-content as page nav menu, validate your HTML, use markdown, support user comments, all the way up to using templated lists and forms for databases if you wanted to using pure SGML.
- zupa-hu 6y agoThat's a good point. So it's not really static site generators vs HTML, it's code based static site generators vs WYSIWYG based static site generators.
- luxuryballs 6y agoI did a prototype of my personal news site in HTML/CSS (no JS for maximum compatibility) with every intention of eventually automating the generation and making a dynamic submission system. I still haven’t bothered because it’s always been less time consuming to just to edit it by hand, and it affords me the occasional customized post/entry whenever I need to post something special. Literally only using either Notepad++/FileZilla on desktop or an iOS FTP text editor combined with iOS Shortcuts if on mobile to generate and apply new posts. For Notepad++ I saved macros for different post formats, the macro pulls the URL from my clipboard and wraps it in the HTML according to which shortcut key. The iOS workflow does the same thing and lives as a cluster of app icons that trigger custom iOS Shortcuts in a folder on my Home screen, I just tap it, it pops-up an iOS input modal asking for the post title, then automatically wraps the HTML around both the text I input as well as the URL I already copied onto my clipboard, then takes the entire HTML chunk and overwrites my clipboard with it so I can paste into the index.html via the iOS FTP text editor. In both cases it’s simple and fast, on iOS the FTP editor is always editing the live file, on desktop I just download the latest using FileZilla prior to doing any edit/upload. When on desktop I also (when not in a hurry) commit the latest version to a git repo. (For larger and less commonly used updates, like formatted sections or special link highlights, I just have a templates.html file that I copy from as needed.)
- arkitaip 6y agoI love what you are basically suggesting is the jerry-rigged version of Frontpage or Dreamweaver.
- luxuryballs 6y agoI mean don’t think of it as a suggestion so much as a natural outcome of the prototype becoming the “official” version due to it being less expensive to finish and more importantly less expensive to change. I still intend on automating it someday, and always told myself I would once I confirmed exactly what I wanted to automate and how. So far, the ability to change the formatting and add custom edits without having to do any real development or deploying anything has been higher value and lower barrier of entry so I’ve yet to find the need and I can update the site in seconds. The only real motivation to automate is for some things like the publishing date and Bitcoin/gold/silver prices at the time, but so far I still have just been editing it manually, and sometimes neglecting to update entirely if I’m in a hurry to just add a breaking headline. I hadn’t thought of the take away but to me that’s what it should be if I were to highlight one, let the productive outcome vs. cost dictate the level of effort, which for web may naturally fall into somewhere on a spectrum between static HTML and cloud container deployments with automated testing and builds from CI deploying a dynamic data driven platform, depending on your needs.
- arkitaip 6y agoI love this because it's a reminder that simplicity is just around the corner if we only are open-minded to rediscover old truths. No complex server software, no package managers, no git, no SSG bullshit - just basic HTML and CSS.
- TacoToni 6y agoI am not a developer. I am simply someone who is fascinated by creating software and websites. I remember taking a HTML/CSS class in high school 12+ years ago and it was one of the most fun classes i've ever taken. Didn't really know i could make a career out of it at the time, but i wish i did. With that said, i love visiting websites that are pure HTML/CSS. They are fast to load and easy to read.
- G3rn0ti 6y agoWell, most developers hate simplicity and simply love automation. From some point on automation usually becomes a process that's merely shifting complexity from a manual process to maintaining a growing software stack. I'd say for a simple web blog managing its entries by means of html files on the server is a valid solution. I am not sure how the author maintains an index of his blog entries this way, but updating an HTML index page manually does not seem like a huge effort to me.
- SketchySeaBeast 6y agoWe always forget we move away from simplicity - this won't scale and if you want to make a global structural change you're now performing the operation as many times as you have pages. I find myself coming back to a metaphor that was in the comments here yesterday - yes, this is a beautiful, stylistic self portrait, but if your job is to paint the whole house this is a terrible way to do it.
- arkitaip 6y agoIn the context of this post, i.e. publishing a small personal blog, simplicity works well.
- mro_name 6y agoI currently think about a tool that does a liiiiiitle bit of what a static site generator does – but based on already valid html input. https://mensuel.framapad.org/p/r.0c8792b90b31b50a91455713a36a789d https://mensuel.framapad.org/p/r.0c8792b90b31b50a91455713a36... And just help a little bit with consistency in terms of keywords & navigation so as there can be a bit of structure in the chaos. Maybe one could even go so far to add a xslt (html -> html) and amend that navigation etc. late in the browser.
- fctorial 6y agoShameless plug: https://fctorial.github.io/posts/constexpr.js.html https://fctorial.github.io/posts/constexpr.js.html A static site generator that uses javascript. You use the browser runtime to generate html.
- zupa-hu 6y agoLol, this is the top comment for me right now. Blog post: don't use static site generators. Top comment: take a look at my static site generator!
- xwolfi 6y ago> Finally, you constantly have to work around the limitations of your static site generator. People have no idea how this simple thing cost so much money in so many companies. The time we spend shoe-horning stuff into stubborn frameworks someone senior, architect, or powerful in general like without having used it is sometimes more than half the budget clients pay for a solution. And it's not just HTML. It's using Mule for API connection (70% of our time spent fixing Mule, swearing at it or hacking it), using Grails for Java servers (this was horrible and already happened to me twice, I could convince the CEO and bypass the leads to rewrite it in a language we all understood the first time, but the second time the company had to close due to endless productivity sinkholes and 200 employees turn around in 1 year...BECAUSE no one understood what the hell was being done), it's using custom made code generators to consume field lists in very complex models which everyone forgot the workings of 10 years later and new guys spend most of their time for months just hacking the generator to add very low value changes, and the list goes on. Adding level of indirections to solve simple problems in an evolving system is now something I try to avoid. I even have to fight "geniuses" by telling them that we need to do the dumbest possible solution first and see what we need, rather than one more crazy framework solving a problem we may never have. And I don't always win...
- macspoofing 6y ago>Doesn't this mean that I have to type a bunch of boilerplate every time I create a new blog post? > >My simple answer is: just copy it. My more advanced answer is this: > >1. Make blog posts and pages self-contained – in other words, have each post or page reside in its own folder, with its own scripts and stylesheets. > >2. When you want to write another post or page, copy the folder of an already existing post or page and edit it. > >3. If you find the previous step too much work, write a shell script that copies the directory and removes the old content for you. Shell script eh ... OK - that'll work ... And now you want to adjust your style and have it apply it to all your existing page. Another shell script? That'll work, though you're on your way in recreating a static site generator.
- deleted 6y ago[deleted]
- Kneecaps07 6y agoHe actually addresses this by saying he doesn't care about the previous posts. They'll just have a different format and are a time capsule.
- matthuggins 6y agoDid you see his update below that paragraph? He admits that he had to update everything, and his pages are not currently a time capsule. It basically negates his entire message.
- lhorie 6y agoFWIW, the screenshot of the page doesn't actually look like how the page looks like currently. One could handwave and say that's intentional, but IMHO it looks as though the styles are broken (in particular the text in really small font and the yellow highlighted text) I think the moral of the story here is that if you're going to be advocating for HTML over a SSG, then perhaps it would make sense to invest a bit of time on a styleguide page, or take a bit more effort to leverage default styles (in the style of http://motherfuckingwebsite.com/ http://motherfuckingwebsite.com/), or just commit to inline styles to lock down the individualistic look of each page (if that's what they want). Being wishy-washy about style management over time is not going to age well.
- CivBase 6y ago> HTML is unpleasant to write. Is it really, though? HTML is a very deep toolbox, but to write blog articles you really only need a handful of tools on the surface level. If you were previously using markdown, all you need to do is review the basic syntax[0] to figure out the equivalent HTML tags. Writing HTML is hardly any less pleasant, albeit a little more verbose, if you just stick to those tags. I think primary value of languages like markdown is input sanitation. If a user makes a mistake in their markdown syntax, there's no risk of it breaking other elements on the page. But when you as the host are the only user, I say pure HTML is the way to go. [0] https://www.markdownguide.org/basic-syntax/ https://www.markdownguide.org/basic-syntax/
- bananicorn 6y agoTo add to that - if you prefer writing the body of the post itself in markdown, and write in VIM, here's a little snippet that might help: :%!markdown_py where markdown_py is your markdown-to-html tool of choice. This will take the whole buffer and turn it into HTML; Otherwise, just select what you want transformed in visual mode, press : and go use it like this: :'<,'>!markdown_py Just felt the need to share - any command line utility can be used in VIM :) (Emacs, VSCode and other editor-using people feel free to chime in, I'm sure there's lots of cool approaches to this)
- deleted 6y ago[deleted]
- lifthrasiir 6y agoI've tried quite a bit of solutions to manage my website for decades. The solution closest to the OP was a plain HTML plus postprocessor (PHP, but only at the preamble to set up the output buffer). I managed to put some hundreds of posts in that system but eventually gave up because it was a pain to read, not write. I desperately needed to read the work in progress to manage my narrative and I couldn't do that with HTML. An HTML editor was not an option because, in addition to being PHP, custom elements to be postprocessed couldn't be easily visualized in conventional HTML editors. I had since went through (more than one) wiki, a custom Python server, m4 and make scripts and several SSGs. (My latest website uses Hugo.) Nowadays however I don't really care; as long as I can read that damn thing I can write anything I want. Do not pursue the perfect website solution; pick a working one, stick to it and don't look back. If it means a plain HTML, so be it.
- gambler 6y agoIf you want to write pages by hand you might look into Cured HTML: https://technology.reclamation.institute/pages/cured-html https://technology.reclamation.institute/pages/cured-html It's a way of styling markup so that you don't have to manually enter P/BR tags. Add ~30 lines of PHP to handle standard boilerplate (html, head, body, etc) and you can manage your website by uploading nearly pure text files to a remote folder. Or by authoring them via command line editor through SSH. If you don't want any languages at all except HTML/JS/CSS, you might even use Server Side Includes.
- gdubs 6y agoAs tinkerers, the personal website is seductive. And that’s fine if you’re mindful of it, or you’re just starting out. But at a certain point it’s a good idea to be clear on what problem you’re trying to solve. And be wary of solving a problem that doesn’t exist, and may never exist. There’s an opportunity cost to spending a bunch of up-front time setting up a bunch of crap you may never take full advantage of. You could be focusing on the content, finding an audience. It’s helpful to zoom out and remember the timeless mantra: “You ain’t gonna need it.”
- codazoda 6y agoI'm a big fan of minimalism and I made a tiny html/css framework for doing this. https://neat.joeldare.com https://neat.joeldare.com I still use Markdown for most of my blog posts. I just let GitHub build it for me. But I'm a fan of always thinking about the simple solution.
- nayuki 6y agoThis is exactly what I do for my website - I write articles directly in HTML code, not Markdown or something else that gets translated to HTML. I draft my articles in plain text or in a WYSIWYG editor, without markup. After I'm satisfied with the content, I go and manually wrap the text in the appropriate markup tags. This includes both inline tags such as <strong>, <code>, <var>, <abbr>, as well as block tags such as <h2>, <p>, <ul>, <li>, <table>, etc. The major reason I use HTML is because I want to use the full palette of HTML features. I don't want to figure out how to use <dl>/<dt>/<dd>/<thead>/<th> and nested lists in Markdown for example. And if I needed to use attributes like <span lang="ja" class="animate">, then any syntax other than HTML offers no simplification anyhow.
- theandrewbailey 6y agoI used to write my site the same way, but I eventually got tired with inserting tags (and closing tags) in my text. Why type more than I need to (and possibly forgetting things) when Markdown can do it for me, and passes any embedded or customized HTML tags, too?
- nayuki 6y agoI don't speak for everyone as situations differ. In my case, I'm not just writing long-form English prose, but I write technical articles that need stuff like <var>/<sup>/<sub>/<code>/<abbr>, decent control over block structure, custom-styled content, and lightly interactive content. You'd have browse my website to see examples of my existing work and why raw HTML works much better for me than Markdown/AsciiDoc/troff/etc.
- ChrisArchitect 6y agoPrevious discussion: https://news.ycombinator.com/item?id=20238289 https://news.ycombinator.com/item?id=20238289 And if you want to do this again, see the followup post they made more recently 6 months ago: http://john.ankarstrom.se/html2/ http://john.ankarstrom.se/html2/
- jascii 6y agoAre you really writing HTML in HTML if you are using a wysiwyg editor?
- hexanal 6y agoIt's fun to see articles like that being posted on HN; it's reassuring, in a way: I've been building my own SSG ( https://github.com/hexanal/fredmercy-blog https://github.com/hexanal/fredmercy-blog ) to be "simple but powerful", and by my own admission it's already a bloated mess, understandable only by its insane creator. At some point, just like John here, I once wondered if I should go back to straight HTML. If we're talking about "Developer Experience", it's cool: I can edit everything with ease in my IDE of choice. To be honest, what I'm missing most with these solutions is a Content Management part: the ability to add content to the website from a mobile device, for example, would be killer. Now all I need is an awesome WYSIWYG HTML editor for mobile...
- vehemenz 6y agoMy theory is that static site generators took off because of young developers learning via local development without the aid of a web server. Old-fashioned HTML/CSS with minimal server-side scripting can do all of this stuff easier with fewer limitations. And you can have dynamic content.
- bccdee 6y agoThe strength of SSGs is that you have the power and simplicity of plain HTML & CSS, but with two special features: - the ability to quickly change styling details on all of your pages - a markdown engine, so that you can write posts more quickly and ergonomically There are other nice features SSGs bring to the table (automatic RSS feed generation for instance) but those two features are the main things that stop me from writing directly in HTML. Especially the first one.
- hutrdvnj 6y agoEinstein said: "Everything should be made as simple as possible, but no simpler". This is an instance of "but no simpler". Any non-trivial page written in only html will eventually evolve into a self-written static site generator, the author even suggests that by recommending shell script to automate html generation. The real simple solution is to use a static site generator, however one could debate whether it is better to write it yourself or to use an existing one.
- door101 6y agoI had a site like this before. I simplified it further by not having a navbar on each page. Every page would share a css stylesheet and have a single link to the homepage. The homepage would have links to all the pages. No templates needed.
- madsbuch 6y agoFor me this appears to be the wrong combination of a solution and a problem. The problem is tech churn, versions are obsolete faster than you can download the packages and the whole ecosystem moves way to fast. The solution is to choose simple and stable solutions. Build a shell script, use low-churn technologies, etc.
- smm11 6y agoContent is King.
- kuharich 6y agoPast comments: https://news.ycombinator.com/item?id=20238289 https://news.ycombinator.com/item?id=20238289
- ducharmdev 6y agoIf you really want something simpler than using a SSG, you can always use pandoc to convert markdown files to HTML. With a one-line command, you can take any arbitrary .md file and spit out .html.
- slk500 6y agoI find holy grail in plain text + org mode export