A place to cache linked articles (think custom and personal wayback machine)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <!doctype html><!-- This is a valid HTML5 document. -->
  2. <!-- Screen readers, SEO, extensions and so on. -->
  3. <html lang="fr">
  4. <!-- Has to be within the first 1024 bytes, hence before the <title>
  5. See: https://www.w3.org/TR/2012/CR-html5-20121217/document-metadata.html#charset -->
  6. <meta charset="utf-8">
  7. <!-- Why no `X-UA-Compatible` meta: https://stackoverflow.com/a/6771584 -->
  8. <!-- The viewport meta is quite crowded and we are responsible for that.
  9. See: https://codepen.io/tigt/post/meta-viewport-for-2015 -->
  10. <meta name="viewport" content="width=device-width,initial-scale=1">
  11. <!-- Required to make a valid HTML5 document. -->
  12. <title>Get Static (archive) — David Larlet</title>
  13. <meta name="description" content="Publication mise en cache pour en conserver une trace.">
  14. <!-- That good ol' feed, subscribe :). -->
  15. <link rel="alternate" type="application/atom+xml" title="Feed" href="/david/log/">
  16. <!-- Generated from https://realfavicongenerator.net/ such a mess. -->
  17. <link rel="apple-touch-icon" sizes="180x180" href="/static/david/icons2/apple-touch-icon.png">
  18. <link rel="icon" type="image/png" sizes="32x32" href="/static/david/icons2/favicon-32x32.png">
  19. <link rel="icon" type="image/png" sizes="16x16" href="/static/david/icons2/favicon-16x16.png">
  20. <link rel="manifest" href="/static/david/icons2/site.webmanifest">
  21. <link rel="mask-icon" href="/static/david/icons2/safari-pinned-tab.svg" color="#07486c">
  22. <link rel="shortcut icon" href="/static/david/icons2/favicon.ico">
  23. <meta name="msapplication-TileColor" content="#f0f0ea">
  24. <meta name="msapplication-config" content="/static/david/icons2/browserconfig.xml">
  25. <meta name="theme-color" content="#f0f0ea">
  26. <!-- Documented, feel free to shoot an email. -->
  27. <link rel="stylesheet" href="/static/david/css/style_2020-06-19.css">
  28. <!-- See https://www.zachleat.com/web/comprehensive-webfonts/ for the trade-off. -->
  29. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_regular.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  30. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_bold.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  31. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_italic.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  32. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_regular.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  33. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_bold.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  34. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_italic.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  35. <script type="text/javascript">
  36. function toggleTheme(themeName) {
  37. document.documentElement.classList.toggle(
  38. 'forced-dark',
  39. themeName === 'dark'
  40. )
  41. document.documentElement.classList.toggle(
  42. 'forced-light',
  43. themeName === 'light'
  44. )
  45. }
  46. const selectedTheme = localStorage.getItem('theme')
  47. if (selectedTheme !== 'undefined') {
  48. toggleTheme(selectedTheme)
  49. }
  50. </script>
  51. <meta name="robots" content="noindex, nofollow">
  52. <meta content="origin-when-cross-origin" name="referrer">
  53. <!-- Canonical URL for SEO purposes -->
  54. <link rel="canonical" href="https://meyerweb.com/eric/thoughts/2020/03/22/get-static/">
  55. <body class="remarkdown h1-underline h2-underline h3-underline hr-center ul-star pre-tick">
  56. <article>
  57. <header>
  58. <h1>Get Static</h1>
  59. </header>
  60. <nav>
  61. <p class="center">
  62. <a href="/david/" title="Aller à l’accueil">🏠</a> •
  63. <a href="https://meyerweb.com/eric/thoughts/2020/03/22/get-static/" title="Lien vers le contenu original">Source originale</a>
  64. </p>
  65. </nav>
  66. <hr>
  67. <main>
  68. <p>If you are in charge of a web site that provides even slightly important information, or important services, <strong>it’s time to get static</strong>.  I’m thinking here of sites for places like health departments (and pretty much all government services), hospitals and clinics, utility services, food delivery and ordering, and I’m sure there are more that haven’t occurred to me.  As much as you possibly can, get it down to static HTML and CSS and maybe a tiny bit of enhancing JS, and pare away every byte you can.</p>
  69. <p>Because too many sites are already crashing because their CMSes can’t keep up with the traffic surges.  And too many sites are using dynamic frameworks that drain mobile batteries and shut out people with older browsers.  That’s annoying and counter-productive in the best of times, but right now, it’s unacceptable.  This is not the time for “well, this is as performant as our stack gets, so I guess users will have to live with it”.  Performance isn’t just something to aspire to any more.  Right now, in some situations, performance could literally be life-saving to a user, or their family.</p>
  70. <p>We’re in this to serve our users.  The best service you can render at this moment is to make sure they can use your site or service, not get <tt>502/Bad Gateway</tt> or a two-minute 20%-battery-drain page render.  Everything should take several back seats to this effort.</p>
  71. <p>I can’t tell you how best to get static—only you can figure that out.  Maybe for you, getting static means using very aggressive server caching and a cache-buster approach to updating info.  Maybe it means using some kind of static-render plugin for your CMS.  Maybe is means accelerating a planned migration to a static-site CMS like <a href="https://jekyllrb.com/">Jekyll</a> or <a href="https://www.11ty.dev/">Eleventy</a><del datetime="2020-04-14T20:01:15+00:00"> or <a href="https://getgrav.org/">Grav</a></del>.  Maybe it means saving pages as HTML from your browser and hand-assembling a static copy of your site for now.  There are a lot of ways to do this, but whatever way you choose, <strong>do it now</strong>.</p>
  72. <hr/>
  73. <p>Addendum: following are a few resources that can help. Please suggest more in the comments!
  74. </p>
  75. <ul>
  76. <li><a href="https://github.com/maxboeck/emergency-site">Emergency Site Kit</a>: “This project aims to enable people to quickly publish a simple website that can withstand large amounts of traffic and will work even under extreme conditions. It is built on the <a href="https://en.wikipedia.org/wiki/Rule_of_least_power">rule of least power</a>, using simple technologies for maximum resilience.”
  77. </li><li><a href="https://www.bing.com/search?q=fastcgi+cache+nginx&#038;qs=n&#038;form=QBRE&#038;sp=-1&#038;pq=fastcgi+cache+nginx&#038;sc=2-19&#038;sk=&#038;cvid=00F6758322E6425BBD79578AD8EB1094">FastCGI Cache for Nginx</a>.</li>
  78. <li><a href="https://sitesauce.app/">Sitesauce</a> is <a href="https://m1guelpiedrafita.typeform.com/to/di6ye0">offering free accounts</a> for critical sites impacted by the pandemic.</li>
  79. </ul>
  80. <ul class="meta">
  81. <li class="date"><cite><a href="https://meyerweb.com/eric/thoughts/2020/03/22/get-static/">Get Static</cite></a> was published on <time>Sunday, March 22nd, 2020</time>.</li>
  82. <li class="cat">It was assigned to the <a href="https://meyerweb.com/eric/thoughts/category/commentary/" rel="category tag">Commentary</a> and <a href="https://meyerweb.com/eric/thoughts/category/tech/web/" rel="category tag">Web</a> categories.</li>
  83. <li class="cmt">There have been <a href="https://meyerweb.com/eric/thoughts/2020/03/22/get-static/#comments">seventeen replies</a>.</li>
  84. </ul>
  85. </main>
  86. </article>
  87. <hr>
  88. <footer>
  89. <p>
  90. <a href="/david/" title="Aller à l’accueil">🏠</a> •
  91. <a href="/david/log/" title="Accès au flux RSS">🤖</a> •
  92. <a href="http://larlet.com" title="Go to my English profile" data-instant>🇨🇦</a> •
  93. <a href="mailto:david%40larlet.fr" title="Envoyer un courriel">📮</a> •
  94. <abbr title="Hébergeur : Alwaysdata, 62 rue Tiquetonne 75002 Paris, +33184162340">🧚</abbr>
  95. </p>
  96. <template id="theme-selector">
  97. <form>
  98. <fieldset>
  99. <legend>Thème</legend>
  100. <label>
  101. <input type="radio" value="auto" name="chosen-color-scheme" checked> Auto
  102. </label>
  103. <label>
  104. <input type="radio" value="dark" name="chosen-color-scheme"> Foncé
  105. </label>
  106. <label>
  107. <input type="radio" value="light" name="chosen-color-scheme"> Clair
  108. </label>
  109. </fieldset>
  110. </form>
  111. </template>
  112. </footer>
  113. <script type="text/javascript">
  114. function loadThemeForm(templateName) {
  115. const themeSelectorTemplate = document.querySelector(templateName)
  116. const form = themeSelectorTemplate.content.firstElementChild
  117. themeSelectorTemplate.replaceWith(form)
  118. form.addEventListener('change', (e) => {
  119. const chosenColorScheme = e.target.value
  120. localStorage.setItem('theme', chosenColorScheme)
  121. toggleTheme(chosenColorScheme)
  122. })
  123. const selectedTheme = localStorage.getItem('theme')
  124. if (selectedTheme && selectedTheme !== 'undefined') {
  125. form.querySelector(`[value="${selectedTheme}"]`).checked = true
  126. }
  127. }
  128. const prefersColorSchemeDark = '(prefers-color-scheme: dark)'
  129. window.addEventListener('load', () => {
  130. let hasDarkRules = false
  131. for (const styleSheet of Array.from(document.styleSheets)) {
  132. let mediaRules = []
  133. for (const cssRule of styleSheet.cssRules) {
  134. if (cssRule.type !== CSSRule.MEDIA_RULE) {
  135. continue
  136. }
  137. // WARNING: Safari does not have/supports `conditionText`.
  138. if (cssRule.conditionText) {
  139. if (cssRule.conditionText !== prefersColorSchemeDark) {
  140. continue
  141. }
  142. } else {
  143. if (cssRule.cssText.startsWith(prefersColorSchemeDark)) {
  144. continue
  145. }
  146. }
  147. mediaRules = mediaRules.concat(Array.from(cssRule.cssRules))
  148. }
  149. // WARNING: do not try to insert a Rule to a styleSheet you are
  150. // currently iterating on, otherwise the browser will be stuck
  151. // in a infinite loop…
  152. for (const mediaRule of mediaRules) {
  153. styleSheet.insertRule(mediaRule.cssText)
  154. hasDarkRules = true
  155. }
  156. }
  157. if (hasDarkRules) {
  158. loadThemeForm('#theme-selector')
  159. }
  160. })
  161. </script>
  162. </body>
  163. </html>