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.

142 lines
5.0 KiB

4 years ago
  1. +++
  2. title = "Quick Install"
  3. description = "One command is all you need to start a new website."
  4. categories = ["core"]
  5. tags = ["setup", "installation", "scripts"]
  6. features = ["code highlighter", "snippets", "related content"]
  7. aliases = [
  8. "/feature/quick-installer/"
  9. ]
  10. [[copyright]]
  11. owner = "Josh Habdas"
  12. date = "2019"
  13. license = "agpl-3.0-or-later"
  14. +++
  15. {{< hackcss-alert type="success" >}}
  16. {{< highlight shell >}}wget -qO - https://go.habd.as/after-dark | sh{{< /highlight >}}
  17. {{< /hackcss-alert >}}
  18. Run the above command in a terminal emulator after {{< external href="https://gohugo.io/getting-started/installing" text="installing Hugo" />}} to start a new website in 5-10 seconds. Hugo version `0.51` or greater required.
  19. ---
  20. After Dark includes a portable installation script for quick set-up. Please install {{< external href="https://gohugo.io" text="Hugo" />}} `0.51` or greater before running:
  21. {{< hackcss-alert >}}
  22. <details itemscope itemtype="https://schema.org/SoftwareSourceCode">
  23. <summary>Expand to view script</summary>
  24. {{< highlight sh "linenos=inline" >}}
  25. {{< include "themes/after-dark/bin/install" >}}
  26. {{< /highlight >}}
  27. <link itemprop="codeRepository" href="https://git.habd.as/comfusion/after-dark">
  28. <meta itemprop="codeSampleType" content="script">
  29. <meta itemprop="programmingLanguage" content="sh">
  30. <meta itemprop="runtimePlatform" content="busybox">
  31. <link itemprop="targetProduct" href="https://after-dark.habd.as">
  32. <meta itemprop="accessMode" content="textual">
  33. </details>
  34. {{< /hackcss-alert >}}
  35. <!--more-->
  36. Script has been tested on GNU/Linux, BSD (Darwin) and Windows via {{< external href="http://cmder.net" text="Cmder" />}}.
  37. {{% hackcss-alert type="warning" %}}**Warning:** Examine scripts downloaded from the Internet before running them.{{% /hackcss-alert %}}
  38. Here are three methods for downloading and running:
  39. 1. Download and pipe to `sh` directly:
  40. {{< hackcss-alert >}}
  41. {{< highlight shell >}}wget -qO - https://go.habd.as/after-dark | sh{{< /highlight >}}
  42. {{< /hackcss-alert >}}
  43. 2. Download into new file, `chmod` and execute:
  44. {{< hackcss-alert >}}
  45. {{< highlight shell >}}curl -O https://cdn.jsdelivr.net/npm/after-dark@latest/bin/install && \
  46. chmod +x install && ./install{{< /highlight >}}
  47. {{< /hackcss-alert >}}
  48. 3. From canonical `git` clone:
  49. {{< hackcss-alert >}}
  50. {{< highlight shell >}}# clone source and change to source directory
  51. git clone https://git.habd.as/comfusion/after-dark.git && cd "$_"
  52. # use npm cli to get the release hash
  53. echo "${$(npm run integrity)#*sha512-}"
  54. # run quick install after validating
  55. ./bin/install
  56. {{< /highlight >}}
  57. {{< /hackcss-alert >}}
  58. Script should complete in 5-10 seconds resulting in a sample site and help docs:
  59. {{< figure alt="After Dark screenshots"
  60. src="/images/quick-install.png"
  61. lqipsrc="/images/quick-install-fs8.png"
  62. caption="After Dark Quick Install running to completion in Terminal on Deepin Manjaro."
  63. >}}
  64. Your new site will be called `flying-toasters`. Change it to the name of your project anytime you like. Access site by navigating to https://localhost:1313.
  65. # Multi-site Configuration (Advanced)
  66. After Dark enables multi-site management from a single installation. To manage multiple websites use the `-c` and `-d` flags to specify the `content` and `destination` directories, respectively.
  67. For example, to generate an audio site using the current After Dark installation create an executable script to generate the site:
  68. {{< hackcss-card header="flying-toasters/bin/gen-audio-site" >}}
  69. {{< highlight shell >}}#!/bin/sh
  70. hugo -c sites/audio -d public/static.domain.example{{< /highlight >}}
  71. {{< /hackcss-card >}}
  72. Where `audio` contains the content for that site:
  73. ```
  74. ├── layouts
  75. ├── sites
  76. │   └── audio
  77. │   ├── audiobooks
  78. │ │ ├── gaining-currency.md
  79. │   │ └── the-power-of-now.md
  80. │   └── clips
  81. │   └── war-of-the-worlds.md
  82. ├── static
  83. ```
  84. And `public` contains a folder for each site:
  85. ```
  86. public
  87. └── static.domain.example
  88. ├── categories
  89. │   └── index.xml
  90. ├── audiobooks
  91. │ └── index.html
  92. ├── clips
  93. │   └── index.html
  94. ├── css
  95. ├── index.html
  96. ├── index.xml
  97. ├── js
  98. ├── sitemap.xml
  99. └── tags
  100. └── index.xml
  101. ```
  102. And create another script to serve the content for editing:
  103. {{< hackcss-card header="flying-toasters/bin/serve-audio-site" >}}
  104. {{< highlight shell >}}#!/bin/sh
  105. hugo -c sites/audio{{< /highlight >}}
  106. {{< /hackcss-card >}}
  107. Each subdirectory of `public` then becomes an independent, deployable website and exact copy save for destination content generated.
  108. {{% hackcss-alert type="info" %}}**Tip:** For additional flexibility type `hugo --help` and modify your scripts using the `--theme` and `--config` flags.{{% /hackcss-alert %}}
  109. Multi-site is perfect for maintaining a consistent look-and-feel across multiple domain origins while limiting the need to run the [Upgrade Script](/feature/upgrade-script/) for each site.