daux.io/For_Developers/Creating_a_Theme.html
2018-06-07 18:43:42 +00:00

223 regels
14 KiB
HTML
Ruw Permalink Blame Geschiedenis

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<title>Creating a Theme - DAUX.IO</title>
<meta name="description" content="The Easiest Way To Document Your Project">
<meta name="author" content="Stéphane Goetz">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="icon" href="../themes/daux/img/favicon-blue.png" type="image/x-icon">
<!-- Mobile -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Font -->
<!-- CSS -->
<link href='../themes/daux/css/theme-blue.min.css' rel='stylesheet' type='text/css'>
<!-- Tipue Search -->
<link href="../tipuesearch/tipuesearch.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="../themes/daux/js/html5shiv-3.7.3.min.js"></script>
<![endif]-->
</head>
<body class="with-float ">
<div class="Columns content">
<aside class="Columns__left Collapsible">
<button type="button" class="Button Collapsible__trigger">
<span class="Collapsible__trigger__bar"></span>
<span class="Collapsible__trigger__bar"></span>
<span class="Collapsible__trigger__bar"></span>
</button>
<a class="Brand" href="../index.html">DAUX.IO</a>
<div class="Search">
<svg class="Search__icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 451 451">
<path d="M447.05 428l-109.6-109.6c29.4-33.8 47.2-77.9 47.2-126.1C384.65 86.2 298.35 0 192.35 0 86.25 0 .05 86.3.05 192.3s86.3 192.3 192.3 192.3c48.2 0 92.3-17.8 126.1-47.2L428.05 447c2.6 2.6 6.1 4 9.5 4s6.9-1.3 9.5-4c5.2-5.2 5.2-13.8 0-19zM26.95 192.3c0-91.2 74.2-165.3 165.3-165.3 91.2 0 165.3 74.2 165.3 165.3s-74.1 165.4-165.3 165.4c-91.1 0-165.3-74.2-165.3-165.4z"/>
</svg>
<input type="search" id="tipue_search_input" class="Search__field" placeholder="Search..." autocomplete="on"
results=25 autosave=text_search>
</div>
<div class="Collapsible__content">
<!-- Navigation -->
<ul class='Nav'><li class='Nav__item '><a href="../Getting_Started.html">Getting Started</a></li><li class='Nav__item has-children'><a href="../Features/Auto_Syntax_Highlight.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Features</a><ul class='Nav'><li class='Nav__item '><a href="../Features/Auto_Syntax_Highlight.html">Auto Syntax Highlight</a></li><li class='Nav__item '><a href="../Features/CommonMark_compliant.html">CommonMark compliant</a></li><li class='Nav__item '><a href="../Features/Edit_on_GitHub_links.html">Edit on GitHub links</a></li><li class='Nav__item '><a href="../Features/Front_Matter.html">Front Matter</a></li><li class='Nav__item '><a href="../Features/Internal_links.html">Internal links</a></li><li class='Nav__item '><a href="../Features/Landing_page.html">Landing page</a></li><li class='Nav__item '><a href="../Features/Live_mode.html">Live mode</a></li><li class='Nav__item '><a href="../Features/Multilanguage.html">Multilanguage</a></li><li class='Nav__item '><a href="../Features/Multiple_Output_Formats.html">Multiple Output Formats</a></li><li class='Nav__item '><a href="../Features/Navigation_and_Sorting.html">Navigation and Sorting</a></li><li class='Nav__item '><a href="../Features/Search.html">Search</a></li><li class='Nav__item '><a href="../Features/Static_Site_Generation.html">Static Site Generation</a></li><li class='Nav__item '><a href="../Features/Table_of_contents.html">Table of contents</a></li></ul></li><li class='Nav__item has-children'><a href="../Examples/index.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Examples</a><ul class='Nav'><li class='Nav__item '><a href="../Examples/Code_Highlighting.html">Code Highlighting</a></li><li class='Nav__item '><a href="../Examples/Hello_World.html">Hello World</a></li><li class='Nav__item '><a href="../Examples/Hello_World_de.html">Hallo Welt</a></li><li class='Nav__item '><a href="../Examples/привет_мир.html">привет мир</a></li><li class='Nav__item '><a href="../Examples/你好世界.html">你好世界</a></li></ul></li><li class='Nav__item has-children'><a href="../Configuration/index.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Configuration</a><ul class='Nav'><li class='Nav__item '><a href="../Configuration/Confluence_upload.html">Confluence upload</a></li><li class='Nav__item '><a href="../Configuration/Html_export.html">Html export</a></li></ul></li><li class='Nav__item Nav__item--open has-children'><a href="../For_Developers/Creating_a_Processor.html" class="folder"><i class="Nav__arrow">&nbsp;</i>For Developers</a><ul class='Nav'><li class='Nav__item '><a href="../For_Developers/Creating_a_Processor.html">Creating a Processor</a></li><li class='Nav__item Nav__item--active'><a href="../For_Developers/Creating_a_Theme.html">Creating a Theme</a></li></ul></li></ul>
<div class="Links">
<hr/>
<a href="https://github.com/dauxio/daux.io/archive/master.zip" target="_blank">Download</a>
<br />
<a href="https://github.com/dauxio/daux.io" target="_blank">GitHub Repo</a>
<br />
<a href="https://github.com/dauxio/daux.io/issues" target="_blank">Help/Support/Bugs</a>
<br />
</div>
<div class="CodeToggler">
<hr/>
<span class="CodeToggler__text">Code blocks</span>
<div class="ButtonGroup" role="group">
<button class="Button Button--default Button--small CodeToggler__button CodeToggler__button--hide">No</button>
<button class="Button Button--default Button--small CodeToggler__button CodeToggler__button--below">Below</button>
<button class="Button Button--default Button--small CodeToggler__button CodeToggler__button--float">Inline</button>
</div>
</div>
<div class="Twitter">
<hr/>
<iframe allowtransparency="true" frameborder="0" scrolling="no" style="width:162px; height:20px;" src="https://platform.twitter.com/widgets/follow_button.html?screen_name=onigoetz&amp;show_count=false"></iframe>
<br />
<br />
</div>
<div class="PoweredBy">
<hr/>
Powered by Daux.io </div>
</div>
</aside>
<div class="Columns__right Columns__right--float">
<div class="Columns__right__content">
<div class="doc_content">
<article class="Page">
<div class="Page__header">
<h1><a href="../For_Developers/Creating_a_Processor.html">For Developers</a> <svg class="Page__header--separator" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 477.175 477.175"><path d="M360.73 229.075l-225.1-225.1c-5.3-5.3-13.8-5.3-19.1 0s-5.3 13.8 0 19.1l215.5 215.5-215.5 215.5c-5.3 5.3-5.3 13.8 0 19.1 2.6 2.6 6.1 4 9.5 4 3.4 0 6.9-1.3 9.5-4l225.1-225.1c5.3-5.2 5.3-13.8.1-19z"/></svg> <a href="../For_Developers/Creating_a_Theme.html">Creating a Theme</a></h1>
<span class="ModifiedDate">
Thursday, June 7, 2018 11:42 AM </span>
<span class="EditOn">
<a href="https://github.com/dauxio/daux.io/blob/master/docs/10_For_Developers/Creating_a_Theme.md" target="_blank">
Edit on GitHub </a>
</span>
</div>
<div class="s-content">
<p>In its simplest form, a theme is an empty folder with a <code>config.json</code> file containing <code>{}</code></p>
<p>After that, every setting is optional, but you can override everything if you'd like to.</p>
<h2 id="page_options"><code>config.json</code> options</h2>
<p>Here is an example <code>config.json</code> file :</p>
<pre><code class="language-json">{
&quot;favicon&quot;: &quot;&lt;theme_url&gt;img/favicon.png&quot;,
&quot;css&quot;: [&quot;&lt;theme_url&gt;css/theme.min.css&quot;],
&quot;js&quot;: [],
&quot;fonts&quot;: [&quot;https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700&amp;subset=latin,cyrillic-ext,cyrillic&quot;],
&quot;variants&quot;: {
&quot;blue&quot;: {
&quot;favicon&quot;: &quot;&lt;theme_url&gt;img/favicon-blue.png&quot;,
&quot;css&quot;: [&quot;&lt;theme_url&gt;css/theme-blue.min.css&quot;]
},
&quot;green&quot;: {
&quot;favicon&quot;: &quot;&lt;theme_url&gt;img/favicon-green.png&quot;,
&quot;css&quot;: [&quot;&lt;theme_url&gt;css/theme-green.min.css&quot;]
}
}
}
</code></pre>
<p>There are five options :</p>
<ul>
<li>
<strong><code>favicon</code></strong>: The URL to your favicon</li>
<li>
<strong><code>css</code></strong>: An array of CSS Stylesheets to add to the page</li>
<li>
<strong><code>js</code></strong>: An array of JavaScript files to load</li>
<li>
<strong><code>fonts</code></strong>: An array of Font sources, these are added as stylesheets</li>
<li>
<strong><code>variants</code></strong>: An object containing sub-themes. Each sub theme, can provide the same configurations as the main theme (<code>favicon</code>, <code>css</code>, <code>js</code>, <code>fonts</code>)</li>
</ul>
<p>You will also notice this <code>&lt;theme_url&gt;</code> in the url.
This is automatically substituted with the final url to the theme when generating the final page.</p>
<p>There are two possible substitutions :</p>
<ul>
<li>
<strong><code>&lt;theme_url&gt;</code></strong>: The url to the current theme</li>
<li>
<strong><code>&lt;base_url&gt;</code></strong>: The url to the documentation root</li>
</ul>
<h2 id="page_Theme-variants">Theme variants</h2>
<p>Like the default Daux.io theme, you might want to provide variants of your theme.</p>
<p>In the example before, there were two variants : blue and green.</p>
<p>The configuration of a variant is added to the configuration of the main theme, it doesn't replace it.</p>
<p>For example the main CSS files defined are: <code>[&quot;&lt;theme_url&gt;css/theme.min.css&quot;]</code> and the green variant defines <code>[&quot;&lt;theme_url&gt;css/theme-green.min.css&quot;]</code>.</p>
<p>The final list of CSS files will be <code>[&quot;&lt;theme_url&gt;css/theme.min.css&quot;, &quot;&lt;theme_url&gt;css/theme-green.min.css&quot;]</code>.</p>
<p>This doesn't apply to <code>favicon</code>, only the last value set is kept.</p>
<h2 id="page_Setting-the-theme-for-your-documentation">Setting the theme for your documentation</h2>
<p>In your documentation's <code>config.json</code> (not the theme's <code>config.json</code>)</p>
<p>Change the <code>theme</code> option inside <code>html</code></p>
<pre><code class="language-json">{
&quot;themes_directory&quot;: &quot;/home/user/themes&quot;,
&quot;html&quot;: {
&quot;theme&quot;: &quot;{theme}-{variant}&quot;
}
}
</code></pre>
<p>The name of the theme, is the folder name.</p>
<p>You can use the <code>themes_directory</code> setting if you want to specify a custom location of your <code>themes</code> folder.</p>
<p>A variant is optional, if you want to add one, separate it from the theme with a dash.</p>
<h2 id="page_Overriding-templates">Overriding templates</h2>
<p>By default, you have a list of templates in <code>templates</code></p>
<p>You can create a folder named <code>templates</code> in your theme, copy-paste the original template in that folder, and you can modify it freely.</p>
<p>You can even do it one template at a time if you wish to do only small changes.</p>
<p>By default, we have the following templates :</p>
<ul>
<li>
<code>content.php</code>: The content page.</li>
<li>
<code>home.php</code>: The landing page.</li>
<li>
<code>error.php</code>: The page to show when a page is not found or some other error happened.</li>
<li>
<code>partials/navbar_content.php</code>: The content of the top navigation bar.</li>
<li>
<code>partials/google_analytics.php</code>: The script to load Google Analytics.</li>
<li>
<code>partials/piwik_analytics.php</code>: The script to load Piwik Analytics.</li>
<li>
<code>layout/00_layout.php</code>: The master template, containing the <code>&lt;html&gt;</code> tag.</li>
<li>
<code>layout/05_page.php</code>: The page layout, with left navigation.</li>
</ul>
</div>
<nav>
<ul class="Pager">
<li class=Pager--prev><a href="../For_Developers/Creating_a_Processor.html">Previous</a></li> </ul>
</nav>
</article>
</div>
</div>
</div>
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-3551397-7', '');
ga('send', 'pageview');
</script>
<!-- JS -->
<script src="../themes/daux/js/jquery-1.11.3.min.js"></script><script src="../themes/daux/js/highlight.pack.js"></script><script src="../themes/daux/js/daux.js"></script>
<!-- Tipue Search -->
<script type="text/javascript" src="../tipuesearch/tipuesearch.js"></script>
<script>
window.onunload = function(){}; // force $(document).ready to be called on back/forward navigation in firefox
$(function() {
tipuesearch({
'base_url': '../'
});
});
</script>
</body>
</html>