Skip to content

Commit

Permalink
Commit /resources/ directory generated by hugo pipes, fix theme demo (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
laozhu committed Nov 8, 2018
1 parent 26d0efa commit 54b585b
Show file tree
Hide file tree
Showing 14 changed files with 67 additions and 61 deletions.
4 changes: 0 additions & 4 deletions assets/scripts/index.js
Expand Up @@ -31,10 +31,6 @@ const randomErrorEmoji = () => {
};
randomErrorEmoji();

// Object-fit polyfill for post cover
/* eslint-disable no-undef */
objectFitImages('img.post-cover');

// Show toTopBtn when scroll to 600px
/* eslint-disable no-undef */
let lastPosition = 0;
Expand Down
4 changes: 0 additions & 4 deletions data/manifest.json

This file was deleted.

2 changes: 2 additions & 0 deletions exampleSite/content/resume.md
Expand Up @@ -3,3 +3,5 @@ title: "Resume"
date: 2017-12-01
layout: "resume"
---

This is my resume.
58 changes: 28 additions & 30 deletions layouts/index.html
@@ -1,31 +1,29 @@
{{ define "main" }}
{{ partial "header.html" . }}
<section class="main post-list">
<header class="list-header offscreen">
<h2 class="list-label">All Posts</h2>
</header>
{{ $paginator := .Paginate (where .Data.Pages "Type" "post") (index .Site.Params "paginate" | default 10) }}
{{ if ne $paginator.TotalPages 0 }}
{{ range $paginator.Pages.ByDate.Reverse }}
{{ .Render "summary" }}
{{ define "main" }} {{ partial "header.html" . }}
<section class="main post-list">
<header class="list-header offscreen">
<h2 class="list-label">All Posts</h2>
</header>
{{ $paginator := .Paginate (where .Data.Pages "Type" "post") (index .Site.Params "paginate" | default 10) }}
{{ if ne $paginator.TotalPages 0 }}
{{ range $paginator.Pages.ByDate.Reverse }} {{ .Render "summary" }} {{ end }}
{{ else }}
<p>There's nothing here.<br />Create an interesting post with the command:</p>
<p><code>$ hugo new post/hello-world.md</code></p>
{{ end }} {{ if gt $paginator.TotalPages 1 }}
<footer class="list-footer">
<nav class="pagination">
<h3 class="offscreen">Pagination</h3>
{{ if $paginator.HasPrev }}
<a class="pagination-previous" href="{{ $paginator.Prev.URL }}"
>← Newer Posts</a
>
{{ end }} {{ if $paginator.HasNext }}
<a class="pagination-next" href="{{ $paginator.Next.URL }}"
>Older Posts →</a
>
{{ end }}
{{ else }}
<p>There's nothing here.<br>Create an interesting post with the command:</p>
<p><code>$ hugo new post/hello-world.md</code></p>
{{ end }}
{{ if gt $paginator.TotalPages 1 }}
<footer class="list-footer">
<nav class="pagination">
<h3 class="offscreen">Pagination</h3>
{{ if $paginator.HasPrev }}
<a class="pagination-previous" href="{{ $paginator.Prev.URL }}">← Newer Posts</a>
{{ end }}
{{ if $paginator.HasNext }}
<a class="pagination-next" href="{{ $paginator.Next.URL }}">Older Posts →</a>
{{ end }}
</nav>
</footer>
{{ end }}
</section>
{{ partial "footer.html" . }}
{{ end }}
</nav>
</footer>
{{ end }}
</section>
{{ partial "footer.html" . }} {{ end }}
6 changes: 3 additions & 3 deletions layouts/partials/footer.html
Expand Up @@ -8,8 +8,8 @@

<!-- Scripts -->
{{ if ne .Kind "home" }}
<script async src="//cdn.bootcss.com/video.js/6.2.8/alt/video.novtt.min.js"></script>
<script async src="//cdn.bootcss.com/mathjax/2.7.2/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script async src="///cdn.jsdelivr.net/npm/video.js@7.3.0/dist/video.min.js"></script>
<script async src="//cdn.jsdelivr.net/npm/mathjax@2.7.5/unpacked/MathJax.min.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
Expand All @@ -20,7 +20,7 @@
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre'],
TeX: { equationNumbers: { autoNumber: "AMS" },
extensions: ["AMSmath.js", "AMSsymbols.js"] }
}
},
});
</script>
<script type="text/x-mathjax-config">
Expand Down
5 changes: 4 additions & 1 deletion layouts/partials/gitment.html
@@ -1,5 +1,8 @@
<div id="gitment-container"></div>
<link rel="stylesheet" href="https://imsun.github.io/gitment/style/default.css">
<link
rel="stylesheet"
href="https://imsun.github.io/gitment/style/default.css"
/>
<script src="https://imsun.github.io/gitment/dist/gitment.browser.js"></script>
<script>
(function() {
Expand Down
6 changes: 5 additions & 1 deletion layouts/partials/head.html
Expand Up @@ -2,6 +2,9 @@
{{ $gohugoio := "gohugoio" }}
{{ $avatar := "/images/avatar.jpg" }}

<!-- DNS Prefetch -->
<link href="//cdn.jsdelivr.net" rel="dns-prefetch">

{{ if eq .Type "post" }}

<!-- Page Author & Description -->
Expand Down Expand Up @@ -93,8 +96,9 @@

<!-- Styles -->
{{ if ne .Kind "home" }}
<link rel="stylesheet" href="//cdn.bootcss.com/video.js/6.2.8/alt/video-js-cdn.min.css" />
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/video.js@7.3.0/dist/video-js.min.css" />
{{ end }}

{{ $options := (dict "targetPath" "styles/style.css" "outputStyle" "compressed" "enableSourceMap" true) }}
{{ $style := resources.Get "sass/main.scss" | resources.ToCSS $options }}
<link rel="stylesheet" href="{{ $style.Permalink }}">
2 changes: 1 addition & 1 deletion layouts/partials/header.html
@@ -1,5 +1,5 @@
<header class="site-header">
<img class="avatar" src="{{ .Site.Params.avatar }}" alt="Avatar">
<img class="avatar" src="{{ "/images/avatar.jpg" | relURL }}" alt="Avatar">
{{ if eq .Kind "home" }}
<h1 class="title">{{ .Site.Title }}</h1>
{{ else }}
Expand Down
22 changes: 10 additions & 12 deletions layouts/partials/polyfill.html
@@ -1,15 +1,13 @@
{{ `<!--[if lt IE 9]>
<script src="//cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
<script src="//cdn.bootcss.com/video.js/6.2.8/ie8/videojs-ie8.min.js"></script>
<![endif]-->` | safeHTML }}
<!-- Polyfill for old browsers -->
{{ `<!--[if lte IE 8]>
<script src="//cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/videojs-ie8@1.1.2/dist/videojs-ie8.min.js"></script>
<![endif]-->` | safeHTML }}

{{ `<!--[if lte IE 11]>
<script src="//cdn.bootcss.com/classlist/1.1.20170427/classList.min.js"></script>
<![endif]-->` | safeHTML }}

<!-- IEdge 9-14, Android < 5, Safari < 10 -->
<script src="//cdn.bootcss.com/object-fit-images/3.2.3/ofi.min.js"></script>
{{ `<!--[if lte IE 9]>
<script src="//cdn.jsdelivr.net/npm/eligrey-classlist-js-polyfill@1.2.20180112/classList.min.js"></script>
<![endif]-->` | safeHTML }}

<!-- Smooth Scroll with closest & requestAnimationFrame Polyfills -->
<script src="//cdn.bootcss.com/smooth-scroll/12.1.4/js/smooth-scroll.polyfills.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/smooth-scroll@14.2.1/dist/smooth-scroll.polyfills.min.js"></script>
@@ -0,0 +1,4 @@
const html=document.querySelector('html');const body=document.querySelector('body');const menuToggle=document.querySelector('.menu-toggle');const menuIcon=document.querySelector('.icon-menu');const siteMenu=document.querySelector('.site-menu');const socialMenu=document.querySelector('.social-menu');const toTopBtn=document.querySelector('.to-top');if(menuToggle){menuToggle.addEventListener('click',()=>{siteMenu.classList.toggle('collapsed');socialMenu.classList.toggle('collapsed');menuIcon.classList.toggle('icon-menu');menuIcon.classList.toggle('icon-close');});}
const randomErrorEmoji=()=>{const error=document.getElementsByClassName('error-emoji')[0];const emojiArray=['\\(o_o)/','(o^^)o','(˚Δ˚)b','(^-^*)','(≥o≤)','(^_^)b','(·_·)','(=\'X\'=)','(>_<)','(;-;)','\\(^Д^)/',];if(error){const errorEmoji=emojiArray[Math.floor(Math.random()*emojiArray.length)];error.appendChild(document.createTextNode(errorEmoji));}};randomErrorEmoji();let lastPosition=0;let ticking=false;window.addEventListener('scroll',()=>{lastPosition=body.scrollTop===0?html.scrollTop:body.scrollTop;if(!ticking){window.requestAnimationFrame(()=>{if(lastPosition>=600){toTopBtn.classList.remove('is-hide');}else{toTopBtn.classList.add('is-hide');}
ticking=false;});}
ticking=true;});const scroll=new SmoothScroll('a[href*="#"]');toTopBtn.addEventListener('click',()=>{scroll.animateScroll(0);});
@@ -0,0 +1 @@
{"Target":"scripts/index.min.js","MediaType":"application/javascript","Data":{}}

Large diffs are not rendered by default.

@@ -0,0 +1 @@
{"Target":"styles/style.css","MediaType":"text/css","Data":{}}
10 changes: 5 additions & 5 deletions theme.toml
Expand Up @@ -3,12 +3,12 @@

name = "Hugo Nuo"
license = "MIT"
licenselink = "https://github.com/laozhu/hugo-nuo/blob/master/LICENSE.md"
licenselink = "https://github.com/laozhu/hugo-nuo/blob/master/LICENSE"
description = "An responsive light & clean hugo theme for blogger."
homepage = "https://github.com/laozhu/hugo-nuo"
tags = ["Responsive", "blog", "Google analytics", "Disqus", "Light", "Clean", "Polyfill"]
features = ["Blog", "Works", "Links", "Portfolio"]
min_version = "0.24"
homepage = "http://github.com/laozhu/hugo-nuo"
tags = ["Responsive", "Lightweight", "Clean", "Customizable"]
features = ["Blog", "Works", "Gallery", "Tags", "Portfolio"]
min_version = "0.50"

[author]
name = "Ritchie Zhu"
Expand Down

0 comments on commit 54b585b

Please sign in to comment.