mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 15:57:57 +00:00
181 lines
15 KiB
HTML
181 lines
15 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en" dir="ltr">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0, minimum-scale=1.0">
|
|
<meta name="generator" content="Hugo 0.120.4">
|
|
<meta name="generator" content="Relearn 5.23.2+tip">
|
|
<meta name="description" content="Documentation for Hugo Relearn Theme">
|
|
<meta name="author" content="Sören Weber">
|
|
<meta name="twitter:card" content="summary_large_image">
|
|
<meta name="twitter:image" content="https://McShelby.github.io/hugo-theme-relearn/images/hero.png">
|
|
<meta name="twitter:title" content="Archetypes :: Hugo Relearn Theme">
|
|
<meta name="twitter:description" content="Documentation for Hugo Relearn Theme">
|
|
<meta property="og:title" content="Archetypes :: Hugo Relearn Theme">
|
|
<meta property="og:description" content="Documentation for Hugo Relearn Theme">
|
|
<meta property="og:type" content="website">
|
|
<meta property="og:url" content="https://McShelby.github.io/hugo-theme-relearn/cont/archetypes/index.html">
|
|
<meta property="og:image" content="https://McShelby.github.io/hugo-theme-relearn/images/hero.png">
|
|
<meta property="og:site_name" content="Hugo Relearn Theme">
|
|
<title>Archetypes :: Hugo Relearn Theme</title>
|
|
<link href="https://McShelby.github.io/hugo-theme-relearn/cont/archetypes/index.html" rel="alternate" hreflang="x-default">
|
|
<link href="https://McShelby.github.io/hugo-theme-relearn/cont/archetypes/index.html" rel="alternate" hreflang="en">
|
|
<link href="https://McShelby.github.io/hugo-theme-relearn/pir/cont/archetypes/index.html" rel="alternate" hreflang="pir">
|
|
<link href="https://McShelby.github.io/hugo-theme-relearn/cont/archetypes/index.html" rel="canonical" type="text/html" title="Archetypes :: Hugo Relearn Theme">
|
|
<link href="../../cont/archetypes/index.xml" rel="alternate" type="application/rss+xml" title="Archetypes :: Hugo Relearn Theme">
|
|
<link href="../../images/logo.svg?1700350567" rel="icon" type="image/svg+xml">
|
|
<!-- https://github.com/filamentgroup/loadCSS/blob/master/README.md#how-to-use -->
|
|
<link href="../../css/fontawesome-all.min.css?1700350567" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="../../css/fontawesome-all.min.css?1700350567" rel="stylesheet"></noscript>
|
|
<link href="../../css/nucleus.css?1700350567" rel="stylesheet">
|
|
<link href="../../css/auto-complete.css?1700350567" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="../../css/auto-complete.css?1700350567" rel="stylesheet"></noscript>
|
|
<link href="../../css/perfect-scrollbar.min.css?1700350567" rel="stylesheet">
|
|
<link href="../../css/fonts.css?1700350567" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="../../css/fonts.css?1700350567" rel="stylesheet"></noscript>
|
|
<link href="../../css/theme.css?1700350567" rel="stylesheet">
|
|
<link href="../../css/theme-auto.css?1700350567" rel="stylesheet" id="R-variant-style">
|
|
<link href="../../css/variant.css?1700350567" rel="stylesheet">
|
|
<link href="../../css/print.css?1700350567" rel="stylesheet" media="print">
|
|
<link href="../../css/format-print.css?1700350567" rel="stylesheet">
|
|
<link href="../../css/ie.css?1700350567" rel="stylesheet">
|
|
<script src="../../js/url.js?1700350567"></script>
|
|
<script src="../../js/variant.js?1700350567"></script>
|
|
<script>
|
|
// hack to let hugo tell us how to get to the root when using relativeURLs, it needs to be called *url= for it to do its magic:
|
|
// https://github.com/gohugoio/hugo/blob/145b3fcce35fbac25c7033c91c1b7ae6d1179da8/transform/urlreplacers/absurlreplacer.go#L72
|
|
window.index_js_url="../../index.search.js";
|
|
var root_url="../../";
|
|
var baseUri=root_url.replace(/\/$/, '');
|
|
window.relearn = window.relearn || {};
|
|
window.relearn.baseUriFull='https:\/\/McShelby.github.io\/hugo-theme-relearn/';
|
|
// variant stuff
|
|
window.variants && variants.init( [ 'auto', 'relearn-bright', 'relearn-light', 'relearn-dark', 'zen-light', 'zen-dark', 'neon', 'learn', 'blue', 'green', 'red' ] );
|
|
// translations
|
|
window.T_Copy_to_clipboard = `Copy to clipboard`;
|
|
window.T_Copied_to_clipboard = `Copied to clipboard!`;
|
|
window.T_Copy_link_to_clipboard = `Copy link to clipboard`;
|
|
window.T_Link_copied_to_clipboard = `Copied link to clipboard!`;
|
|
window.T_Reset_view = `Reset view`;
|
|
window.T_View_reset = `View reset!`;
|
|
window.T_No_results_found = `No results found for "{0}"`;
|
|
window.T_N_results_found = `{1} results found for "{0}"`;
|
|
</script>
|
|
<style>
|
|
#R-body img.bg-white {
|
|
background-color: white;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body class="mobile-support print disableInlineCopyToClipboard" data-url="../../cont/archetypes/index.html">
|
|
<div id="R-body" class="default-animation">
|
|
<div id="R-body-overlay"></div>
|
|
<nav id="R-topbar">
|
|
<div class="topbar-wrapper">
|
|
<div class="topbar-sidebar-divider"></div>
|
|
<div class="topbar-area topbar-area-start" data-area="start">
|
|
<div class="topbar-button topbar-button-sidebar" data-content-empty="disable" data-width-s="show" data-width-m="hide" data-width-l="hide">
|
|
<button class="topbar-control" onclick="toggleNav()" type="button" title="Menu (CTRL+ALT+n)">
|
|
<i class="fa-fw fas fa-bars"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<ol class="topbar-breadcrumbs breadcrumbs highlightable" itemscope itemtype="http://schema.org/BreadcrumbList"><li
|
|
itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement"><a itemprop="item" href="../../cont/index.html"><span itemprop="name">Content</span></a><meta itemprop="position" content="1"> > </li><li
|
|
itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement"><span itemprop="name">Archetypes</span><meta itemprop="position" content="2"></li>
|
|
</ol>
|
|
<div class="topbar-area topbar-area-end" data-area="end">
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
<div id="R-main-overlay"></div>
|
|
<main id="R-body-inner" class="highlightable default" tabindex="-1">
|
|
<div class="flex-block-wrapper">
|
|
<article class="default">
|
|
<header class="headline">
|
|
</header>
|
|
<h1 id="archetypes">Archetypes</h1>
|
|
|
|
<p>Using the command: <code>hugo new [relative new content path]</code>, you can start a content file with the date and title automatically set. While this is a welcome feature, active writers need more: <a href="https://gohugo.io/content/archetypes/" target="_blank">archetypes</a>. These are preconfigured skeleton pages with default frontmatter.</p>
|
|
<p>The Relearn theme defines some few archetypes of pages but you are free to define new ones to your liking. All can be used at any level of the documentation, the only difference being the layout of the content.</p>
|
|
<h2 id="predefined-archetypes">Predefined Archetypes</h2>
|
|
<h3 id="archetypes-home">Home</h3>
|
|
<p>A <strong>Home</strong> page is the starting page of your project. It’s best to have only one page of this kind in your project.</p>
|
|
<p><a href="#R-image-b5a547b71709d86367e9e7d3d893a49e" class="lightbox-link"><img src="../../cont/archetypes/pages-home.png?width=60pc" alt="Home page" class="figure-image bg-white border lightbox noshadow" style="height: auto; width: 60pc;" loading="lazy"></a>
|
|
<a href="javascript:history.back();" class="lightbox-back" id="R-image-b5a547b71709d86367e9e7d3d893a49e"><img src="../../cont/archetypes/pages-home.png?width=60pc" alt="Home page" class="lightbox-image bg-white border lightbox noshadow" loading="lazy"></a></p>
|
|
<p>To create a home page, run the following command</p>
|
|
<div class="wrap-code highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">hugo new --kind home _index.md</span></span></code></pre></div><p>This leads to a file with the following content</p>
|
|
<div class="wrap-code highlight"><pre tabindex="0" class="chroma"><code class="language-markdown" data-lang="markdown"><span class="line"><span class="cl">+++
|
|
</span></span><span class="line"><span class="cl">archetype = "home"
|
|
</span></span><span class="line"><span class="cl">title = "{{ replace .Name "-" " " | title }}"
|
|
</span></span><span class="line"><span class="cl">+++
|
|
</span></span><span class="line"><span class="cl">
|
|
</span></span><span class="line"><span class="cl">Lorem Ipsum.</span></span></code></pre></div><h3 id="archetypes-chapter">Chapter</h3>
|
|
<p>A <strong>Chapter</strong> displays a page meant to be used as introduction for a set of child pages. Commonly, it contains a simple title and a catch line to define content that can be found below it.</p>
|
|
<p><a href="#R-image-cca6f575a266b92af86ee16de9ed4d0a" class="lightbox-link"><img src="../../cont/archetypes/pages-chapter.png?width=60pc" alt="Chapter page" class="figure-image bg-white border lightbox noshadow" style="height: auto; width: 60pc;" loading="lazy"></a>
|
|
<a href="javascript:history.back();" class="lightbox-back" id="R-image-cca6f575a266b92af86ee16de9ed4d0a"><img src="../../cont/archetypes/pages-chapter.png?width=60pc" alt="Chapter page" class="lightbox-image bg-white border lightbox noshadow" loading="lazy"></a></p>
|
|
<p>To create a chapter page, run the following command</p>
|
|
<div class="wrap-code highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">hugo new --kind chapter <name>/_index.md</span></span></code></pre></div><p>This leads to a file with the following content</p>
|
|
<div class="wrap-code highlight"><pre tabindex="0" class="chroma"><code class="language-markdown" data-lang="markdown"><span class="line"><span class="cl">+++
|
|
</span></span><span class="line"><span class="cl">archetype = "chapter"
|
|
</span></span><span class="line"><span class="cl">title = "{{ replace .Name "-" " " | title }}"
|
|
</span></span><span class="line"><span class="cl">weight = X
|
|
</span></span><span class="line"><span class="cl">+++
|
|
</span></span><span class="line"><span class="cl">
|
|
</span></span><span class="line"><span class="cl">Lorem Ipsum.</span></span></code></pre></div><p>Replace the <code>X</code> with a number. Because this number will be used to generate the subtitle of the chapter page, set the number to a consecutive value starting at 1 for each new chapter level.</p>
|
|
<h3 id="archetypes-default">Default</h3>
|
|
<p>A <strong>Default</strong> page is any other content page. If you set an unknown archetype in your frontmatter, this archetype will be used to generate the page.</p>
|
|
<p><a href="#R-image-4a229d908aef8e6164c3c7865b5ce3f5" class="lightbox-link"><img src="../../cont/archetypes/pages-default.png?width=60pc" alt="Default page" class="figure-image bg-white border lightbox noshadow" style="height: auto; width: 60pc;" loading="lazy"></a>
|
|
<a href="javascript:history.back();" class="lightbox-back" id="R-image-4a229d908aef8e6164c3c7865b5ce3f5"><img src="../../cont/archetypes/pages-default.png?width=60pc" alt="Default page" class="lightbox-image bg-white border lightbox noshadow" loading="lazy"></a></p>
|
|
<p>To create a default page, run either one of the following commands</p>
|
|
<div class="wrap-code highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">hugo new <chapter>/<name>/_index.md</span></span></code></pre></div><p>or</p>
|
|
<div class="wrap-code highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">hugo new <chapter>/<name>.md</span></span></code></pre></div><p>This leads to a file with the following content</p>
|
|
<div class="wrap-code highlight"><pre tabindex="0" class="chroma"><code class="language-markdown" data-lang="markdown"><span class="line"><span class="cl">+++
|
|
</span></span><span class="line"><span class="cl">title = "{{ replace .Name "-" " " | title }}"
|
|
</span></span><span class="line"><span class="cl">weight = X
|
|
</span></span><span class="line"><span class="cl">+++
|
|
</span></span><span class="line"><span class="cl">
|
|
</span></span><span class="line"><span class="cl">Lorem Ipsum.</span></span></code></pre></div><p>Replace the <code>X</code> with a number or delete the whole <code>weight</code> parameter entirely.</p>
|
|
<h2 id="self-defined-archetypes">Self defined Archetypes</h2>
|
|
<p>If you are in need of further archetypes you can define your own or even redefine existing ones.</p>
|
|
<h3 id="template">Template</h3>
|
|
<p>Define a template file in your project at <code>archetypes/<kind>.md</code> and make sure it has at least the frontmatter parameter for that archetype like</p>
|
|
<div class="wrap-code highlight"><pre tabindex="0" class="chroma"><code class="language-markdown" data-lang="markdown"><span class="line"><span class="cl">+++
|
|
</span></span><span class="line"><span class="cl">archetype = "<span class="p"><</span><span class="nt">kind</span><span class="p">></span>"
|
|
</span></span><span class="line"><span class="cl">+++</span></span></code></pre></div><p>Afterwards you can generate new content files of that kind with the following command</p>
|
|
<div class="wrap-code highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">hugo new --kind <kind> <name>/_index.md</span></span></code></pre></div><h3 id="partials">Partials</h3>
|
|
<p>To define how your archetypes are rendered, define corresponding partial files in your projects directory <code>layouts/partials/archetypes/<kind></code>.</p>
|
|
<p>If you use an unknown archetype in your frontmatter, the <code>default</code> archetype will be used to generate the page.</p>
|
|
<p>Related to each archetype, several <em>hook</em> partial files in the form of <code><hook>.html</code> can be given inside each archetype directory. If a partial for a specific hook is missing, no output is generated for this hook.</p>
|
|
<p>The following hooks are used:</p>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Notes</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>styleclass</td>
|
|
<td>Defines a set of CSS classes to be added to the HTML’s <code><main></code> element. You can use these classes to define own CSS rules in your <code>custom-header.html</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>article</td>
|
|
<td>Defines the HTML how to render your content</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>Take a look at the existing archetypes of this theme to get an idea how to utilize it.</p>
|
|
<h4 id="output-formats">Output formats</h4>
|
|
<p>Each hook file can be overridden of a specific <a href="https://gohugo.io/templates/output-formats/" target="_blank">output format</a>. Eg. if you define a new output format <code>PLAINTEXT</code> in your <code>config.toml</code>, you can add a file <code>layouts/partials/archetypes/default.plaintext.html</code> to change the way how normal content is written for that output format.</p>
|
|
|
|
<footer class="footline">
|
|
</footer>
|
|
</article>
|
|
|
|
</div>
|
|
</main>
|
|
</div>
|
|
<script src="../../js/clipboard.min.js?1700350568" defer></script>
|
|
<script src="../../js/perfect-scrollbar.min.js?1700350568" defer></script>
|
|
<script src="../../js/theme.js?1700350568" defer></script>
|
|
</body>
|
|
</html>
|