diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 8beed90767e77f7cafbe1ac15323351e741190fa..0000000000000000000000000000000000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "web/themes/hugo-flex"] - path = web/themes/hugo-flex - url = https://github.com/de-souza/hugo-flex.git diff --git a/web/themes/hugo-flex b/web/themes/hugo-flex deleted file mode 160000 index eb5e35185457e68cdfafa90bc5eef578266bb430..0000000000000000000000000000000000000000 --- a/web/themes/hugo-flex +++ /dev/null @@ -1 +0,0 @@ -Subproject commit eb5e35185457e68cdfafa90bc5eef578266bb430 diff --git a/web/themes/hugo-flex/LICENSE b/web/themes/hugo-flex/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..73deed2d1f03c8dfe3296e209106b5cdd6da7dba --- /dev/null +++ b/web/themes/hugo-flex/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2019 Léo de Souza + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/web/themes/hugo-flex/README.md b/web/themes/hugo-flex/README.md new file mode 100644 index 0000000000000000000000000000000000000000..035b7023a17835384887e184c8c3e89b513db94f --- /dev/null +++ b/web/themes/hugo-flex/README.md @@ -0,0 +1,186 @@ +# Hugo Flex + +A lightweight Hugo theme leveraging CSS Flexbox. + +This theme is verified to work with Hugo versions v0.65–v0.104. + + +## Features + +- Flexbox-based responsive layout +- 100% speed score on PageSpeed Insight +- No framework +- No javascript +- Full posts in RSS feed +- RSS page looks like a normal page + +Optional features: + +- Show summaries on homepage +- Schema.org, Open Graph and Twitter Cards metadata +- Utterances comments widget +- Custom CSS and JS may be added [site-wide](#custom-css-and-js), or [dynamically](#dynamically-embedded) with shortcodes +- Built-in shortcodes: + - Netlify contact form + - On-click Soundcloud player + + +## Example + +The [demo site](https://de-souza.github.io/hugo-flex/) is built from the [hugoBasicExample](https://github.com/gohugoio/hugoBasicExample) repository. + +A complete starter template specifically made for this theme is also available at [scivision/hugo-flex-example](https://github.com/scivision/hugo-flex-example). + + +## Installation + +1. [Install Hugo](https://gohugo.io/getting-started/installing/). + +2. [Create a Hugo site](https://gohugo.io/getting-started/quick-start/). + +3. Open a command prompt at the root of the site and download the theme: + +```bash +git init +git submodule add https://github.com/de-souza/hugo-flex.git themes/hugo-flex +``` + +4. Add the theme to the site configuration: + +```bash +echo 'theme: hugo-flex' >> config.yaml +``` + + +## Updating + +Open a command prompt at the root of the site and update the theme: + +```bash +git submodule update --remote --rebase +``` + + +## Configuration + +Any part of the default theme configuration can be overwritten in the site configuration: + +```yaml +params: + color: teal # Any color in CSS syntax + width: 42rem # Any length in CSS syntax + footer: >- # HTML spaces ( ) are needed before HTML elements + Except where otherwise noted, content on this site is licensed under a   + <a href="http://creativecommons.org/licenses/by/4.0/" rel="license">Creative + Commons Attribution 4.0 International License</a>. + rss: To subscribe to this RSS feed, copy its address and paste it into your + favorite feed reader. + summaries: false # Set to true to show summaries of posts on homepage + divider: \a0 # Set to false to remove divider below posts on homepage + schema: false # Set to true to add Schema.org metadata + opengraph: false # Set to true to add Open Graph metadata + twittercards: false # Set to true to add Twitter Cards metadata + utterances: + repo: # Set to Utterances repo URL to add Utterances comments + issueterm: pathname + theme: github-light + netlify: + honeypot: false # Set to true to add honeypot field in contact form + recaptcha: false # Set to true to add recaptcha challenge in contact form + # css: # Uncomment to add custom CSS from the assets directory + # - css/foo.css + # - bar.css + # js: # Uncomment to add custom JS from the assets directory + # - js/foo.js + # - bar.js + +menu: + nav: + - name: About + url: about/ + weight: 1 + - name: Posts + url: post/ + weight: 2 + - name: Tags + url: tags/ + weight: 3 + - name: Categories + url: categories/ + weight: 4 + - name: RSS + url: index.xml + weight: 5 +``` + + +## Built-In Shortcodes + +### Netlify Contact Form + +A contact form working with the Netlify form handling service may be inserted with the shortcode: + +``` +{{< contact >}} +``` + +A custom success page URL may be given as a parameter: + +``` +{{< contact "/success" >}} +``` + +### Soundcloud Player + +A Soundcloud Player may be inserted with the shortcode: + +``` +{{< soundcloud 123456789 >}} +``` + +The parameter is a track ID that can be extracted from the "embed" sharing menu on the track page. + + +## Custom CSS and JS + +### Site-Wide + +Custom CSS and JS can be added to all the site pages at once. To do so, their filenames can be added to the site configuration: + +```yaml +params: + css: + - css/foo.css + - bar.css + js: + - js/foo.js + - bar.js +``` + +The paths are relative to the project working directory. +In this example, the file paths relative to the site root would be `assets/css/foo.css`, `assets/bar.css`, `assets/js/foo.js`, `assets/bar.js`. + + +### Dynamically Embedded + +CSS and JS resources may be embedded on specific pages of the site using [shortcodes](https://gohugo.io/content-management/shortcodes). + +To load a resource on each page where a shortcode is used, the template for this shortcode must add the resource to the `css` or `js` key of the `.Scratch` variable. For instance, a shortcode template `myshortcode.html` containing the line + +```html +{{ resources.Get "myscript.js" | fingerprint | .Page.Scratch.SetInMap "js" "myscript" }} +``` + +will load `myscript.js` on every page where `myshortcode` is used. + +As an example, this is the template for the built-in Soundcloud shortcode: + +```html +{{ resources.Get "css/soundcloud.css" | minify | fingerprint | .Page.Scratch.SetInMap "css" "soundcloud" }} +{{ resources.Get "js/soundcloud.js" | minify | fingerprint | .Page.Scratch.SetInMap "js" "soundcloud" }} +<div class="Soundcloud" data-id="{{ .Get 0 }}"></div> +``` + +## License + +This theme is licensed under the [Apache License 2.0](https://github.com/de-souza/hugo-flex/blob/master/LICENSE). diff --git a/web/themes/hugo-flex/assets/css/base.tpl.css b/web/themes/hugo-flex/assets/css/base.tpl.css new file mode 100644 index 0000000000000000000000000000000000000000..327007da2090260a92c7b592cd05dcd2d68ba29a --- /dev/null +++ b/web/themes/hugo-flex/assets/css/base.tpl.css @@ -0,0 +1,136 @@ +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; + line-height: 1.6; + display: flex; + flex-direction: column; + min-height: 100vh; + margin: 0; + padding: 0; +} + +main { + flex-grow: 1; +} + +img { + max-width: 100%; + border-radius: 0.2rem; +} + +pre { + overflow-x: auto; + border: 0.1rem solid lightgray; + padding: 1rem; +} + +code { + font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; +} + +.Banner { + list-style: none; + display: flex; + flex-flow: row-reverse wrap-reverse; + justify-content: space-between; + margin: 0; + padding: 0; +} + +{{ $len := len site.Menus.nav }} +{{ range seq $len }} + + .Banner-item:nth-child({{ . }}) { + order: {{ sub $len . | add 1 }}; + } + +{{ end }} + +.Banner-item--title { + flex-grow: 1; +} + +.Banner-link { + font-size: 1.25rem; + color: white; + padding: 0.5rem 1rem; +} + +.Heading { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + align-items: baseline; +} + +.Heading-title { + margin: 1.5rem 0.5rem 0 0; +} + +.Heading-link { + color: inherit; +} + +.Tags { + list-style: none; + display: flex; + flex-wrap: wrap; + justify-content: center; + margin: 1.5rem 0; + padding: 0; +} + +.Tags-item { + border-radius: 0.2rem; + margin: 0.2rem; + padding: 0 0.3rem; +} + +.Tags-link { + color: white; +} + +{{ with site.Params.divider }} + + .Divider { + display: flex; + justify-content: center; + } + + .Divider::after { + content: "{{ . }}"; + } + +{{ end }} + +.Pagination { + font-size: 1.25rem; + color: inherit; +} + +.Pagination--right { + float: right; +} + +.Footer { + text-align: center; + margin: 1rem 0; +} + +.u-wrapper { + {{ with site.Params.width }}max-width: {{ . }};{{ end }} + margin: auto; +} + +.u-padding { + padding: 0 1rem; +} + +.u-background { + background: {{ site.Params.color }}; +} + +.u-clickable { + font-weight: bold; + text-decoration: none; + display: inline-block; +} diff --git a/web/themes/hugo-flex/assets/css/contact.css b/web/themes/hugo-flex/assets/css/contact.css new file mode 100644 index 0000000000000000000000000000000000000000..5241a52875cc88b66f312bf5299cb9e72b4ae7da --- /dev/null +++ b/web/themes/hugo-flex/assets/css/contact.css @@ -0,0 +1,39 @@ +.Contact { + max-width: 30rem; + margin: 1.5rem auto; +} + +.Contact-group { + list-style-type: none; + margin: 0; + padding: 0; +} + +.Contact-hidden { + display: none; +} + +.Contact-item { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + margin: 0.5rem 0; +} + +.Contact-label { + flex-basis: 5rem; +} + +.Contact-input { + flex-grow: 1; + flex-basis: 15rem; +} + +.Contact-input--textbox { + resize: vertical; + height: 5rem; +} + +.Contact-button { + margin-left: auto; +} diff --git a/web/themes/hugo-flex/assets/css/soundcloud.css b/web/themes/hugo-flex/assets/css/soundcloud.css new file mode 100644 index 0000000000000000000000000000000000000000..69fbfb2768e8122cc985615fd64624b6ae622d67 --- /dev/null +++ b/web/themes/hugo-flex/assets/css/soundcloud.css @@ -0,0 +1,26 @@ +.Soundcloud { + height: 166px; +} + +.Soundcloud:empty { + display: none; +} + +.Soundcloud-iframe { + height: 100%; + width: 100%; + border: 0; +} + +.Soundcloud-player { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 100%; + border: 0.1rem solid lightgray; + border-radius: 0.3rem; + background: whitesmoke; + cursor: pointer; +} diff --git a/web/themes/hugo-flex/assets/js/soundcloud.js b/web/themes/hugo-flex/assets/js/soundcloud.js new file mode 100644 index 0000000000000000000000000000000000000000..22c425b47c396dc71a6160acb4a01d999fa47b8b --- /dev/null +++ b/web/themes/hugo-flex/assets/js/soundcloud.js @@ -0,0 +1,20 @@ +const soundcloud = (() => { + for (const wrapper of document.querySelectorAll(".Soundcloud")) { + const iframe = document.createElement("iframe"); + iframe.className = "Soundcloud-iframe"; + iframe.setAttribute("src", `https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/${wrapper.getAttribute('data-id')}&show_comments=false`); + const link = document.createElement("a"); + link.setAttribute("href", "https://soundcloud.com/pages/cookies"); + link.textContent = "cookie policy"; + link.onclick = e => e.stopPropagation(); + link.onkeydown = e => e.stopPropagation(); + const player = document.createElement("div"); + player.className = "Soundcloud-player"; + player.setAttribute("tabindex", "0"); + player.textContent = 'Load player'; + player.appendChild(link); + player.onclick = () => wrapper.replaceChild(iframe, player); + player.onkeydown = e => { if (e.keyCode == 13) wrapper.replaceChild(iframe, player) }; + wrapper.appendChild(player); + }; +})(); diff --git a/web/themes/hugo-flex/assets/xml/base.tpl.xml b/web/themes/hugo-flex/assets/xml/base.tpl.xml new file mode 100644 index 0000000000000000000000000000000000000000..de6aaf6242691ea8b7b007964ee994c7d871dab4 --- /dev/null +++ b/web/themes/hugo-flex/assets/xml/base.tpl.xml @@ -0,0 +1,54 @@ +{{ safeHTML `<?xml version="1.0" encoding="utf-8" ?>` }} +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:output method="html" doctype-system="about:legacy-compat" /> + <xsl:template match="/rss/channel"> + <html lang="{{ site.LanguageCode }}"> + <head> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + {{ hugo.Generator }} + <title><xsl:value-of select="title" /></title> + {{ $site_css := (.Scratch.Get "css").base }} + <link rel="stylesheet" href="{{ $site_css.Permalink }}" integrity="{{ $site_css.Data.Integrity }}" /> + </head> + <body> + <nav class="u-background"> + <div class="u-wrapper"> + <ul class="Banner"> + <li class="Banner-item Banner-item--title"> + <a class="Banner-link u-clickable" href="{{ absURL nil }}">{{ site.Title }}</a> + </li> + {{ range site.Menus.nav }} + <li class="Banner-item"> + <a class="Banner-link u-clickable" href="{{ absURL .URL }}">{{ .Name }}</a> + </li> + {{ end }} + </ul> + </div> + </nav> + <main> + <div class="u-wrapper"> + <div class="u-padding"> + <h2 class="Heading-title"> + <a class="Heading-link u-clickable" href="{link}" rel="bookmark"><xsl:value-of select="title" /></a> + </h2> + {{ with site.Params.rss }} + <p> + {{ safeHTML . }} + </p> + {{ end }} + </div> + </div> + </main> + {{ with site.Params.footer }} + <footer class="Footer"> + <div class="u-wrapper"> + <div class="u-padding"> + {{ safeHTML . }} + </div> + </div> + </footer> + {{ end }} + </body> + </html> + </xsl:template> +</xsl:stylesheet> diff --git a/web/themes/hugo-flex/config.yaml b/web/themes/hugo-flex/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9e3b15f52163cc25f11754cbbc7270d19001d8c2 --- /dev/null +++ b/web/themes/hugo-flex/config.yaml @@ -0,0 +1,52 @@ +params: + color: gray # Any color in CSS syntax + width: 42rem # Any length in CSS syntax + # footer: >- # A hardcoded space is needed before each html element + # Except where otherwise noted, content on this site is licensed under a   + # <a href="http://creativecommons.org/licenses/by/4.0/" rel="license">Creative + # Commons Attribution 4.0 International License</a>. + # rss: To subscribe to this RSS feed, copy its address and paste it into your + # favorite feed reader. + summaries: false # Set to true to show summaries of posts on homepage + divider: \a0 # Set to false to remove divider below posts on homepage + schema: false # Set to true to add Schema.org metadata + opengraph: false # Set to true to add Open Graph metadata + twittercards: false # Set to true to add Twitter Cards metadata + utterances: + repo: # Set to Utterances repo URL to add Utterances comments + issueterm: pathname + theme: github-light + netlify: + honeypot: false # Set to true to add honeypot field in contact form + recaptcha: false # Set to true to add recaptcha challenge in contact form + # css: # Uncomment to add custom CSS from a list of files + # - css/foo.css + # - bar.css + # js: # Uncomment to add custom JS from a list of files + # - js/foo.js + # - bar.js + + +menu: + nav: + - name: Thèmes + url: content/ + weight: 1 + - name: Evaluation + url: content3/ + weight: 2 + - name: Emploi du temps + url: content2/ + weight: 2 + # - name: Thèmes + # url: content/ + # weight: 2 + # - name: Tags + # url: tags/ + # weight: 3 + # - name: Categories + # url: categories/ + # weight: 4 + # - name: RSS + # url: index.xml + # weight: 5 diff --git a/web/themes/hugo-flex/images/screenshot.png b/web/themes/hugo-flex/images/screenshot.png new file mode 100644 index 0000000000000000000000000000000000000000..de05a3c8b9d4c6587339e8cfad42fea79ffb7a32 Binary files /dev/null and b/web/themes/hugo-flex/images/screenshot.png differ diff --git a/web/themes/hugo-flex/images/tn.png b/web/themes/hugo-flex/images/tn.png new file mode 100644 index 0000000000000000000000000000000000000000..bbd09af8452d535cc1ffd22e7f51aef21f413e08 Binary files /dev/null and b/web/themes/hugo-flex/images/tn.png differ diff --git a/web/themes/hugo-flex/layouts/_default/baseof.html b/web/themes/hugo-flex/layouts/_default/baseof.html new file mode 100644 index 0000000000000000000000000000000000000000..bc7f8097b4fadaa4dea4b08d1d103bba8921621b --- /dev/null +++ b/web/themes/hugo-flex/layouts/_default/baseof.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<html lang="{{ site.LanguageCode }}"> + +<head> + {{ partial "meta.html" . }} + {{ partial "title.html" . }} + {{ partial "link.html" . }} + {{ partial "load_site_assets.html" . }} + {{ block "load_page_assets" . }} + {{ with .Content }}{{ end }} + {{ end }} + {{ partial "assets.html" . }} +</head> + +<body> + {{ partialCached "banner.html" . }} + <main> + <div class="u-wrapper"> + <div class="u-padding"> + {{ block "main" . }}{{ end }} + </div> + </div> + </main> + {{ partialCached "footer.html" . }} +</body> + +</html> diff --git a/web/themes/hugo-flex/layouts/_default/home.html b/web/themes/hugo-flex/layouts/_default/home.html new file mode 100644 index 0000000000000000000000000000000000000000..02bbee5d965d46b8ebea7fcdd5c2c99278b21eca --- /dev/null +++ b/web/themes/hugo-flex/layouts/_default/home.html @@ -0,0 +1,51 @@ +{{ define "load_page_assets" }} + + {{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} + + {{ $paginator := .Paginate $pages }} + + {{ range $paginator.Pages }} + {{ with .Content }}{{ end }} + {{ $page_css := .Scratch.Get "css" }} + {{ with $page_css }} + {{ $css_list := $.Scratch.Get "css" }} + {{ . | merge $css_list | $.Scratch.Set "css" }} + {{ end }} + {{ $page_js := .Scratch.Get "js" }} + {{ with $page_js }} + {{ $js_list := $.Scratch.Get "js" }} + {{ . | merge $js_list | $.Scratch.Set "js" }} + {{ end }} + {{ end }} + + {{ $paginator | .Scratch.Set "paginator" }} + +{{ end }} + +{{ define "main" }} + + {{ $paginator := .Scratch.Get "paginator" }} + + {{ range $paginator.Pages }} + <article> + {{ partial "heading.html" . }} + {{ if site.Params.summaries }} + {{ .Summary }} + {{ if .Truncated }} + <p> + <a class="u-clickable" href="{{ .RelPermalink }}">Read More…</a> + </p> + {{ end }} + {{ else }} + {{ .Content }} + {{ end }} + {{ partial "tags.html" . }} + </article> + {{ with site.Params.divider }} + <div class="Divider"></div> + {{ end }} + {{ end }} + + {{ partial "pagination.html" . }} + +{{ end }} diff --git a/web/themes/hugo-flex/layouts/_default/list.html b/web/themes/hugo-flex/layouts/_default/list.html new file mode 100644 index 0000000000000000000000000000000000000000..dca50cc2576b2ab1f5e0afcc2424ecfe076bc30d --- /dev/null +++ b/web/themes/hugo-flex/layouts/_default/list.html @@ -0,0 +1,18 @@ +{{ define "main" }} + + {{ partial "heading.html" . }} + + {{ .Content }} + + {{ range .Pages.GroupByPublishDate "2006" }} + <h3>{{ .Key }}</h3> + <ul> + {{ range .Pages }} + <li> + {{ .PublishDate.Format "2006-01-02" }} – <a href="{{ .RelPermalink }}">{{ .Title }}</a> + </li> + {{ end }} + </ul> + {{ end }} + +{{ end }} diff --git a/web/themes/hugo-flex/layouts/_default/rss.xml b/web/themes/hugo-flex/layouts/_default/rss.xml new file mode 100644 index 0000000000000000000000000000000000000000..ea9e46a7181c364c415debf4a04bbd20620de31f --- /dev/null +++ b/web/themes/hugo-flex/layouts/_default/rss.xml @@ -0,0 +1,30 @@ +{{- $base_xml := resources.Get "xml/base.tpl.xml" | resources.ExecuteAsTemplate "xml/base.xml" . | minify }} +{{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} +{{- $limit := .Site.Config.Services.RSS.Limit }} +{{- if ge $limit 1 }} + {{- $pages = $pages | first $limit }} +{{- end }} +{{- safeHTML `<?xml version="1.0" encoding="utf-8" ?>` }} +{{ printf `<?xml-stylesheet type="text/xsl" href=%q ?>` $base_xml.Permalink | safeHTML }} +<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> + <channel> + <title>{{ if eq .Title site.Title }}{{ site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ site.Title }}{{ end }}</title> + <link>{{ .Permalink }}</link> + <description>Recent content {{ if ne .Title site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ site.Title }}</description> + <generator>Hugo -- gohugo.io</generator>{{ with site.LanguageCode }} + <language>{{ . }}</language>{{ end }}{{ with site.Author.email }} + <managingEditor>{{ . }}{{ with site.Author.name }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with site.Author.email }} + <webMaster>{{ . }}{{ with site.Author.name }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with site.Copyright }} + <copyright>{{ . }}</copyright>{{ end }}{{ with .Date | default nil }} + <lastBuildDate>{{ .Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}{{ with .OutputFormats.Get "RSS" }} + {{ printf `<atom:link href=%q rel="self" type=%q />` .Permalink .MediaType | safeHTML }}{{ end }}{{ range $pages }} + <item> + <title>{{ .Title }}</title> + <link>{{ .Permalink }}</link>{{ with .PublishDate | default nil }} + <pubDate>{{ .Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>{{ end }}{{ with site.Author.email }} + <author>{{ . }}{{ with site.Author.name }} ({{ . }}){{ end }}</author>{{ end }} + <guid>{{ .Permalink }}</guid> + <description>{{ html .Content }}</description> + </item>{{ end }} + </channel> +</rss> diff --git a/web/themes/hugo-flex/layouts/_default/single.html b/web/themes/hugo-flex/layouts/_default/single.html new file mode 100644 index 0000000000000000000000000000000000000000..f1c4fc53005fdaedbba4b6f0da512ba48618370d --- /dev/null +++ b/web/themes/hugo-flex/layouts/_default/single.html @@ -0,0 +1,10 @@ +{{ define "main" }} + + <article> + {{ partial "heading.html" . }} + {{ .Content }} + {{ partial "tags.html" . }} + {{ partial "comments.html" . }} + </article> + +{{ end }} diff --git a/web/themes/hugo-flex/layouts/_default/terms.html b/web/themes/hugo-flex/layouts/_default/terms.html new file mode 100644 index 0000000000000000000000000000000000000000..a93860a8ecf18f6c2ddaba5790060f1b285fc689 --- /dev/null +++ b/web/themes/hugo-flex/layouts/_default/terms.html @@ -0,0 +1,15 @@ +{{ define "main" }} + + {{ partial "heading.html" . }} + + {{ .Content }} + + <ul class="Tags"> + {{ range .Pages }} + <li class="Tags-item u-background"> + <a class="Tags-link u-clickable" href="{{ .RelPermalink }}">{{ .Title }}</a> + </li> + {{ end }} + </ul> + +{{ end }} diff --git a/web/themes/hugo-flex/layouts/partials/assets.html b/web/themes/hugo-flex/layouts/partials/assets.html new file mode 100644 index 0000000000000000000000000000000000000000..43a533be0a5a630ab2aef1dc4f1705172804364b --- /dev/null +++ b/web/themes/hugo-flex/layouts/partials/assets.html @@ -0,0 +1,7 @@ +{{ range .Scratch.GetSortedMapValues "css" }} + <link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"> +{{ end }} + +{{ range .Scratch.GetSortedMapValues "js" }} + <script defer src="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"></script> +{{ end }} \ No newline at end of file diff --git a/web/themes/hugo-flex/layouts/partials/banner.html b/web/themes/hugo-flex/layouts/partials/banner.html new file mode 100644 index 0000000000000000000000000000000000000000..dc123b8c1027a668761271772129203ec0075959 --- /dev/null +++ b/web/themes/hugo-flex/layouts/partials/banner.html @@ -0,0 +1,14 @@ +<nav class="u-background"> + <div class="u-wrapper"> + <ul class="Banner"> + <li class="Banner-item Banner-item--title"> + <a class="Banner-link u-clickable" href="{{ relURL nil }}">{{ site.Title }}</a> + </li> + {{ range site.Menus.nav }} + <li class="Banner-item"> + <a class="Banner-link u-clickable" href="{{ relURL .URL }}">{{ .Name }}</a> + </li> + {{ end }} + </ul> + </div> +</nav> \ No newline at end of file diff --git a/web/themes/hugo-flex/layouts/partials/comments.html b/web/themes/hugo-flex/layouts/partials/comments.html new file mode 100644 index 0000000000000000000000000000000000000000..0f6b002928752d9eea0157bc8ca57d3616577ebf --- /dev/null +++ b/web/themes/hugo-flex/layouts/partials/comments.html @@ -0,0 +1,5 @@ +{{ with site.Params.utterances }} + {{ if $.Type | in site.Params.mainSections | and .repo }} + <script src="https://utteranc.es/client.js" repo="{{ .repo }}" issue-term="{{ .issueterm }}" theme="{{ .theme }}" crossorigin="anonymous" async></script> + {{end}} +{{end}} \ No newline at end of file diff --git a/web/themes/hugo-flex/layouts/partials/footer.html b/web/themes/hugo-flex/layouts/partials/footer.html new file mode 100644 index 0000000000000000000000000000000000000000..0c631d643d64b45c6fd998d7983639de250d5813 --- /dev/null +++ b/web/themes/hugo-flex/layouts/partials/footer.html @@ -0,0 +1,9 @@ +{{ with site.Params.footer }} + <footer class="Footer"> + <div class="u-wrapper"> + <div class="u-padding"> + {{ safeHTML . }} + </div> + </div> + </footer> +{{ end }} \ No newline at end of file diff --git a/web/themes/hugo-flex/layouts/partials/heading.html b/web/themes/hugo-flex/layouts/partials/heading.html new file mode 100644 index 0000000000000000000000000000000000000000..e62f2162a2031d43d4ece693bea2655461a7399a --- /dev/null +++ b/web/themes/hugo-flex/layouts/partials/heading.html @@ -0,0 +1,10 @@ +<header class="Heading"> + <h2 class="Heading-title"> + <a class="Heading-link u-clickable" href="{{ .RelPermalink }}" rel="bookmark">{{ .Title }}</a> + </h2> + {{ with .PublishDate | default nil }} + <time datetime="{{ .Format "2006-01-02T15:04:05Z07:00" }}"> + {{- .Format "2 January, 2006" -}} + </time> + {{ end }} +</header> \ No newline at end of file diff --git a/web/themes/hugo-flex/layouts/partials/link.html b/web/themes/hugo-flex/layouts/partials/link.html new file mode 100644 index 0000000000000000000000000000000000000000..8a6ac9c1cc2a7fc7b0cb715ad6607427f32a10cc --- /dev/null +++ b/web/themes/hugo-flex/layouts/partials/link.html @@ -0,0 +1,5 @@ +<link rel="canonical" href="{{ .RelPermalink }}"> + +{{ range .AlternativeOutputFormats }} + {{ printf "<link rel=%q type=%q href=%q title=%q>" .Rel .MediaType .RelPermalink site.Title | safeHTML }} +{{ end }} \ No newline at end of file diff --git a/web/themes/hugo-flex/layouts/partials/load_site_assets.html b/web/themes/hugo-flex/layouts/partials/load_site_assets.html new file mode 100644 index 0000000000000000000000000000000000000000..8f3ee7c962ab7975fd6e8acdfd290376b9050040 --- /dev/null +++ b/web/themes/hugo-flex/layouts/partials/load_site_assets.html @@ -0,0 +1,24 @@ +{{ $base_css := resources.Get "css/base.tpl.css" | resources.ExecuteAsTemplate "css/base.css" . }} + +{{ $site_css := $base_css }} + +{{ with site.Params.css }} + {{ $css_list := slice $site_css }} + {{ range . }} + {{ $custom_css := resources.Get . }} + {{ $css_list = $css_list | append $custom_css }} + {{ end }} + {{ $site_css = $css_list | resources.Concat "css/base.css" }} +{{ end }} + +{{ minify $site_css | fingerprint | .Page.Scratch.SetInMap "css" "base" }} + +{{ with site.Params.js }} + {{ $js_list := slice }} + {{ range . }} + {{ $custom_js := resources.Get . }} + {{ $js_list = $js_list | append $custom_js }} + {{ end }} + {{ $site_js := $js_list | resources.Concat "js/base.js" }} + {{ minify $site_js | fingerprint | $.Page.Scratch.SetInMap "js" "base" }} +{{ end }} \ No newline at end of file diff --git a/web/themes/hugo-flex/layouts/partials/meta.html b/web/themes/hugo-flex/layouts/partials/meta.html new file mode 100644 index 0000000000000000000000000000000000000000..6a1448e394e96c4e3d60036f0711b35558699a42 --- /dev/null +++ b/web/themes/hugo-flex/layouts/partials/meta.html @@ -0,0 +1,29 @@ +<meta charset="utf-8"> + +<meta name="viewport" content="width=device-width, initial-scale=1.0"> + +{{ with .Description }} + <meta name="description" content="{{ . }}"> +{{ else }} + {{ if .IsPage }} + <meta name="description" content="{{ .Summary }}"> + {{ else }} + {{ with site.Params.description }} + <meta name="description" content="{{ . }}"> + {{ end }} + {{ end }} +{{ end }} + +{{ if site.Params.schema }} + {{ template "_internal/schema.html" . }} +{{ end }} + +{{ if site.Params.opengraph }} + {{ template "_internal/opengraph.html" . }} +{{ end }} + +{{ if site.Params.twittercards }} + {{ template "_internal/twitter_cards.html" . }} +{{ end }} + +{{ hugo.Generator }} \ No newline at end of file diff --git a/web/themes/hugo-flex/layouts/partials/pagination.html b/web/themes/hugo-flex/layouts/partials/pagination.html new file mode 100644 index 0000000000000000000000000000000000000000..25fca9742a7fef60dce54f35a6a04bd4cfa23be1 --- /dev/null +++ b/web/themes/hugo-flex/layouts/partials/pagination.html @@ -0,0 +1,12 @@ +{{ $paginator := .Scratch.Get "paginator" }} + +{{ if gt $paginator.TotalPages 1 }} + <nav> + {{ with $paginator.Next }} + <a class="Pagination u-clickable" href="{{ .URL }}" rel="prev">« Previous</a> + {{ end }} + {{ with $paginator.Prev }} + <a class="Pagination Pagination--right u-clickable" href="{{ .URL }}" rel="next">Next »</a> + {{ end }} + </nav> +{{ end }} \ No newline at end of file diff --git a/web/themes/hugo-flex/layouts/partials/tags.html b/web/themes/hugo-flex/layouts/partials/tags.html new file mode 100644 index 0000000000000000000000000000000000000000..198ceca46f25cb5cdca5f61983651428abaf0179 --- /dev/null +++ b/web/themes/hugo-flex/layouts/partials/tags.html @@ -0,0 +1,23 @@ +{{ $taxonomy_list := slice }} + +{{ range $taxonomy, $_ := site.Taxonomies }} + {{ $taxonomy_list = $taxonomy_list | append $taxonomy }} +{{ end }} + +{{ $taxonomy_is_used_list := apply $taxonomy_list "isset" .Params "." }} + +{{ if true | in $taxonomy_is_used_list }} + <footer> + {{ range $taxonomy := $taxonomy_list }} + {{ if isset $.Params $taxonomy }} + <ul class="Tags"> + {{ range $.GetTerms $taxonomy }} + <li class="Tags-item u-background"> + <a class="Tags-link u-clickable" href="{{ .RelPermalink }}" rel="tag">{{ .LinkTitle }}</a> + </li> + {{ end }} + </ul> + {{ end }} + {{ end }} + </footer> +{{ end }} \ No newline at end of file diff --git a/web/themes/hugo-flex/layouts/partials/title.html b/web/themes/hugo-flex/layouts/partials/title.html new file mode 100644 index 0000000000000000000000000000000000000000..7ed2b42e4fc8534449f95995b226e661a19d5487 --- /dev/null +++ b/web/themes/hugo-flex/layouts/partials/title.html @@ -0,0 +1,7 @@ +<title> + {{- if eq .Title site.Title -}} + {{ site.Title }} + {{- else -}} + {{ with .Title }}{{ . }} | {{ end }}{{ site.Title }} + {{- end -}} +</title> \ No newline at end of file diff --git a/web/themes/hugo-flex/layouts/shortcodes/contact.html b/web/themes/hugo-flex/layouts/shortcodes/contact.html new file mode 100644 index 0000000000000000000000000000000000000000..f6d800a7b6e60cf729135351771233e623d17d75 --- /dev/null +++ b/web/themes/hugo-flex/layouts/shortcodes/contact.html @@ -0,0 +1,32 @@ +{{ resources.Get "css/contact.css" | minify | fingerprint | .Page.Scratch.SetInMap "css" "contact" }} + +<form class="Contact" name="contact" method="POST" data-netlify="true"{{ if site.Params.netlify.honeypot }} data-netlify-honeypot="bot"{{ end }}{{ if site.Params.netlify.recaptcha }} data-netlify-recaptcha="true"{{ end }}{{ with .Get 0 }} action="{{ . }}"{{ end }}> + <ul class="Contact-group"> + {{ if site.Params.netlify.honeypot }} + <li class="Contact-hidden"> + <label>Don’t fill this out if you're human:</label> + <input name="bot"> + </li> + {{ end }} + <li class="Contact-item"> + <label class="Contact-label" for="Contact-name">Name:</label> + <input class="Contact-input" id="Contact-name" type="text" name="name" autofocus> + </li> + <li class="Contact-item"> + <label class="Contact-label" for="Contact-email">Email:</label> + <input class="Contact-input" id="Contact-email" type="email" name="email"> + </li> + <li class="Contact-item"> + <label class="Contact-label" for="Contact-subject">Subject:</label> + <input class="Contact-input" id="Contact-subject" type="text" name="subject"> + </li> + <li class="Contact-item"> + <label class="Contact-label" for="Contact-message">Message:</label> + <textarea class="Contact-input Contact-input--textbox" id="Contact-message" name="message"></textarea> + </li> + <li class="Contact-item"> + <button class="Contact-button" type="submit">Send</button> + </li> + </ul> + {{ if site.Params.netlify.recaptcha }}<div data-netlify-recaptcha="true"></div>{{ end }} +</form> diff --git a/web/themes/hugo-flex/layouts/shortcodes/soundcloud.html b/web/themes/hugo-flex/layouts/shortcodes/soundcloud.html new file mode 100644 index 0000000000000000000000000000000000000000..b3d28016a6d95a23d0e32df1bbfacbe2dd9b4b90 --- /dev/null +++ b/web/themes/hugo-flex/layouts/shortcodes/soundcloud.html @@ -0,0 +1,5 @@ +{{ resources.Get "css/soundcloud.css" | minify | fingerprint | .Page.Scratch.SetInMap "css" "soundcloud" }} + +{{ resources.Get "js/soundcloud.js" | minify | fingerprint | .Page.Scratch.SetInMap "js" "soundcloud" }} + +<div class="Soundcloud" data-id="{{ .Get 0 }}"></div> diff --git a/web/themes/hugo-flex/theme.toml b/web/themes/hugo-flex/theme.toml new file mode 100644 index 0000000000000000000000000000000000000000..0009ae6e1be6dbb43f7cf5fcffe25079fe637559 --- /dev/null +++ b/web/themes/hugo-flex/theme.toml @@ -0,0 +1,13 @@ +name = "Hugo Flex" +license = "Apache-2.0" +licenselink = "https://github.com/de-souza/hugo-flex/blob/master/LICENSE" +description = "A lightweight Hugo theme leveraging CSS Flexbox" +homepage = "https://github.com/de-souza/hugo-flex/" +demosite = "https://de-souza.github.io/hugo-flex/" +tags = ["responsive", "minimal", "flexbox", "no-javascript"] +features = ["posts"] +min_version = "0.65" + +[author] + name = "Léo De Souza" + homepage = "https://github.com/de-souza/"