alguidelines.dev - Business Central Design Patterns – Install Hugohttps://alguidelines.dev/docs/contributing/installhugo/Recent content in Install Hugo on alguidelines.dev - Business Central Design PatternsHugo -- gohugo.ioen-usDocs: Devcontainer with VS Codehttps://alguidelines.dev/docs/contributing/installhugo/theshortcut/Mon, 01 Jan 0001 00:00:00 +0000https://alguidelines.dev/docs/contributing/installhugo/theshortcut/ <h2 id="use-a-local-devcontainer">Use a local devcontainer</h2> <p>If you don&rsquo;t want any local setup (apart from Docker Desktop), but still run your own Hugo instance, you can make use of the preconfigured devcontainer. If you want to learn more about the concept, visit <a href="https://code.visualstudio.com/docs/remote/containers">https://code.visualstudio.com/docs/remote/containers</a>. To use it, you need to take the following steps:</p> <ol> <li>Start <a href="https://www.docker.com/products/docker-desktop">Docker Desktop</a> and <a href="https://docs.docker.com/desktop/windows/#switch-between-windows-and-linux-containers">switch to Linux containers</a> by right-clicking on the Docker logo in the system tray and selecting &ldquo;Switch to Linux containers&hellip;&rdquo;. If you only see &ldquo;Switch to Windows containers&hellip;&rdquo;, then you are already switched to Linux containers. If anything goes wrong, check if you are on the latest version of Docker Desktop and have <a href="https://docs.docker.com/desktop/windows/wsl/#install">the WSL2 integration enabled</a>. If you have all that in place and it still doesn&rsquo;t work, check the extended installation documentation <a href="https://code.visualstudio.com/docs/remote/containers#_installation">here</a> <div class="alert alert-info" role="alert"> <h4 class="alert-heading">Consequences of switching</h4> When switching to Linux, you will probably see a warning that tells you that you &ldquo;will not be able to manage the Windows containers until you switch back to Windows containers&rdquo;. That means that the Docker Desktop management GUI can only show either the Windows containers or the Linux containers and if you switch to Linux, you consequently won&rsquo;t see the Windows containers until you switch back. But the Windows containers will continue to run, you won&rsquo;t loose data and you can keep using them e.g. for Business Central development, you just can&rsquo;t manage them through the Docker Desktop GUI </div> </li> <li>Install the <a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack">Remote development extension pack</a> in Visual Studio Code</li> <li>Run the action &ldquo;Remote containers: Clone Repository in Container Volume&rdquo; and select the fork you created. If you haven&rsquo;t done that before, go through the <a href="https://alguidelines.dev/docs/contributing/forkandpr/#step-1-fork">docs</a>.</li> <li>Wait for a bit. When you do this for the first time, it can take a couple of minutes. Next time it will be faster&hellip;</li> <li>After a while, you will have VS Code with the cloned repository and the terminal should show something like &ldquo;Done. Press any key to close the terminal.&rdquo;</li> <li>Run the action &ldquo;Tasks: Run task&rdquo; and select &ldquo;Start local Hugo Server&rdquo; from the list. If you don&rsquo;t see that entry, you might have to reload your VS Code window and try again</li> <li>After Hugo has generated the site, you will get a notification that offers you to &ldquo;Open a browser&rdquo;. Click on that and you will see your local instance of the AL guidelines! Again, on the first try it will be a bit slow and sluggish, but the second one should be fast.</li> <li>Now you can make changes and just save them. If you open the terminal, you will see a message that tells you that a change was detected and the site was rebuilt. After that, the change should automatically appear in your browser</li> </ol> <p>Here is a walkthrough of the full process:</p> <video width=100% controls> <source src="alguidelines walkthrough.mp4" type="video/mp4"> Your browser does not support the video tag. </video> <h2 id="use-github-codespaces">Use GitHub Codespaces</h2> <p>What is also great about this, is that you can also use <a href="https://github.com/features/codespaces">GitHub Codespaces</a> with that setup. In that case, steps 1-5 become two clicks&hellip; Here is another full walkthrough:</p> <video width=100% controls> <source src="alguidelines codespace.mp4" type="video/mp4"> Your browser does not support the video tag. </video>Docs: Manually on Windows 11https://alguidelines.dev/docs/contributing/installhugo/manuallyonwindows11/Mon, 01 Jan 0001 00:00:00 +0000https://alguidelines.dev/docs/contributing/installhugo/manuallyonwindows11/ <p>This guide will walk You thrugh installing Hugo on a Windows 11 PC. For the official install guide, You can wisit <a href="https://gohugo.io/getting-started/installing/">https://gohugo.io/getting-started/installing/</a>.</p> <h2 id="download-binaries">Download Binaries</h2> <p>The path of least resistance is to just download the .zip file from the official Hugo GitHub Repository <a href="https://github.com/gohugoio/hugo/releases">here</a>.</p> <p>The theme that are used, needs the extended version of Hugo, so make sure to download the <strong>extended</strong> version by ensuring the file name starts with <code>hugo_extended...</code></p> <div class="alert alert-info" role="alert"> <h4 class="alert-heading">info</h4> <p>For the purpose of this install guide, we are assuming You will want to follow the &ldquo;standard&rdquo; used by Hugo for installing. We will be creating a <code>Hugo</code> folder in the root of <code>C:\</code>. That folder will have a <code>Bin</code> folder for the binaries, and a <code>Sites</code> folder for each website You are building.</p> <p>Once You are done, You should have a folder structure that looks like this:</p> <div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>C:\Hugo </span></span><span style="display:flex;"><span>├── Bin # Binaries </span></span><span style="display:flex;"><span>└┬─ Sites # Hugo Site Repositories </span></span><span style="display:flex;"><span> └── alguidelines # Hugo Source for alguidelines.dev </span></span></code></pre></div> </div> <p><img src="SelectExtended.png" alt="image"></p> <p>After downloading the .zip file, extract the zip-file to <code>c:\Hugo\Bin</code></p> <p><img src="Extract.png" alt="image"></p> <p><img src="ExtractToBin.png" alt="image"></p> <h2 id="add-hugo-to-path">Add Hugo to Path</h2> <p>After copying the binaries to Your PC, You will need to add Hugo binaries to the <code>%PATH%</code> system environment variables.</p> <p>To do that, search for <code>environment</code></p> <p><img src="SearchForEnv.png" alt="image"></p> <p>once you see the <code>Edit the system environment variables</code>, open it and select <code>Environment Variables</code></p> <p><img src="SystemProperties.png" alt="image"></p> <p>Once the Environment Variables screen is open, highlight the <code>Path</code> lines and press the <code>Edit...</code> button</p> <p><img src="EnvironmentVariables.png" alt="image"></p> <p>Now press <code>New</code> and add the <code>C:\Hugo\Bin</code> to the path. Press <code>OK</code> and <code>OK</code> to save the new <code>Path</code></p> <p><img src="EnvironmentVariablesPath.png" alt="image"></p> <p>Once complete. You should now be able to preview the Hugo site on <a href="http://localhost:1313">http://localhost:1313</a> by opening a command promt, and open the <code>C:\Hugo\Sites\alguidelines</code> folder and execute <code>Hugo Serve</code></p> <p><img src="HugoServe.png" alt="image"></p>Docs: Powershell on Windows 11https://alguidelines.dev/docs/contributing/installhugo/usingpowershellonwindows11/Mon, 01 Jan 0001 00:00:00 +0000https://alguidelines.dev/docs/contributing/installhugo/usingpowershellonwindows11/ <p>It is possible to use a powershell script and Chocolatey to install and other dependencies. Execute the following script:</p> <div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-powershell" data-lang="powershell"><span style="display:flex;"><span><span style="color:#204a87">Set-ExecutionPolicy</span> <span style="color:#000">Bypass</span> <span style="color:#000">-Scope</span> <span style="color:#204a87;font-weight:bold">Process</span> <span style="color:#000">-Force</span> </span></span><span style="display:flex;"><span><span style="color:#000">[System.Net.ServicePointManager]</span><span style="color:#000;font-weight:bold">::</span><span style="color:#000">SecurityProtocol</span> <span style="color:#000;font-weight:bold">=</span> <span style="color:#000">[System.Net.ServicePointManager]</span><span style="color:#000;font-weight:bold">::</span><span style="color:#000">SecurityProtocol</span> <span style="color:#ce5c00;font-weight:bold">-bor</span> <span style="color:#000">3072</span> </span></span><span style="display:flex;"><span><span style="color:#204a87">Invoke-Expression</span> <span style="color:#000;font-weight:bold">((</span><span style="color:#204a87">New-Object</span> <span style="color:#000">System</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Net</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">WebClient</span><span style="color:#000;font-weight:bold">).</span><span style="color:#000">DownloadString</span><span style="color:#000;font-weight:bold">(</span><span style="color:#4e9a06">&#39;https://community.chocolatey.org/install.ps1&#39;</span><span style="color:#000;font-weight:bold">))</span> </span></span><span style="display:flex;"><span><span style="color:#000">choco</span> <span style="color:#000">install</span> <span style="color:#000">-y</span> <span style="color:#000">nodejs</span> </span></span><span style="display:flex;"><span><span style="color:#000">choco</span> <span style="color:#000">install</span> <span style="color:#000">-y</span> <span style="color:#204a87">hugo-extended</span> </span></span></code></pre></div><p>Once complete, in root of of the repository execute the following commands</p> <div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-powershell" data-lang="powershell"><span style="display:flex;"><span><span style="color:#000">git</span> <span style="color:#000">submodule</span> <span style="color:#000">update</span> <span style="color:#000;font-weight:bold">-</span><span style="color:#000">-init</span> <span style="color:#000;font-weight:bold">-</span><span style="color:#000">-recursive</span> <span style="color:#000;font-weight:bold">-</span><span style="color:#000">-depth</span> <span style="color:#000">1</span> </span></span><span style="display:flex;"><span><span style="color:#000">npm</span> <span style="color:#000">install</span> </span></span></code></pre></div>