-
-
-
- {{ range .Site.Data.projects.projects }}
- {{ partial "cards/project" . }}
- {{ end }}
+
+
+ {{ range .Site.Data.projects.projects }}
+ {{ partial "cards/project" . }}
+ {{ end }}
+
-
+ {{ end }}
diff --git a/layouts/partials/recent-posts.html b/layouts/partials/recent-posts.html
index 8cb8f2c89f8..10508f44f3b 100644
--- a/layouts/partials/recent-posts.html
+++ b/layouts/partials/recent-posts.html
@@ -2,7 +2,7 @@
Recent Posts
- {{ range first 3 (where .Site.RegularPages.ByDate.Reverse "Type" "!=" "section" )}}
+ {{ range first 3 (where .Site.RegularPages.ByDate.Reverse "Type" "in" site.Params.mainSections )}}
{{ partial "cards/recent-post.html" . }}
{{ end }}
diff --git a/layouts/partials/skills.html b/layouts/partials/skills.html
index 45b0c4f5184..8088b4d1037 100644
--- a/layouts/partials/skills.html
+++ b/layouts/partials/skills.html
@@ -1,11 +1,13 @@
-
Skills
+ {{ if .Site.Data.skills }}
+
Skills
-
-
- {{ range .Site.Data.skills.skills }}
- {{ partial "cards/skill.html" . }}
- {{ end }}
+
+
+ {{ range .Site.Data.skills.skills }}
+ {{ partial "cards/skill.html" . }}
+ {{ end }}
+
-
+ {{ end }}
diff --git a/static/assets/css/single.css b/static/assets/css/single.css
index 1e8e4cba329..747684d2d55 100644
--- a/static/assets/css/single.css
+++ b/static/assets/css/single.css
@@ -136,6 +136,24 @@ pre>code {
padding: 10px !important;
}
+a.header-anchor{
+ text-decoration: none;
+ color: #1c2d41;
+}
+
+a.header-anchor i{
+ font-size: 10pt;
+ color: #3c4858;
+ display: none;
+ margin-left: 0.5rem;
+}
+a.header-anchor:hover i{
+ display: inline-block;
+}
+a.header-anchor code{
+ color: #e83e8c;
+}
+
.navbar-toggler {
display: none;
}
diff --git a/static/assets/js/home.js b/static/assets/js/home.js
index f9b278ca2ad..cca42dfe7e5 100644
--- a/static/assets/js/home.js
+++ b/static/assets/js/home.js
@@ -91,15 +91,18 @@ var projectCards;
function adjustSkillCardsHeight() {
if (!isMobile) { // no need to adjust height for mobile devices
// primary skills
- var el = document.getElementById("primary-skills").children;
- var maxHeight = 0;
- for (let i = 0; i < el.length; i++) {
- if (el[i].children[0].clientHeight > maxHeight) {
- maxHeight = el[i].children[0].clientHeight;
+ var skillCards = document.getElementById("primary-skills");
+ if (skillCards != null) {
+ var el = skillCards.children;
+ var maxHeight = 0;
+ for (let i = 0; i < el.length; i++) {
+ if (el[i].children[0].clientHeight > maxHeight) {
+ maxHeight = el[i].children[0].clientHeight;
+ }
+ }
+ for (let i = 0; i < el.length; i++) {
+ el[i].children[0].setAttribute("style", "min-height: " + maxHeight + "px;")
}
- }
- for (let i = 0; i < el.length; i++) {
- el[i].children[0].setAttribute("style", "min-height: " + maxHeight + "px;")
}
}
}
@@ -107,15 +110,19 @@ var projectCards;
// ================== Project cards =====================
// Add click action on project category selector buttons
- var btns = document.getElementById("project-filter-buttons").children;
+ var filterButtons = document.getElementById("project-filter-buttons");
+ if (filterButtons != null) {
+ var btns = filterButtons.children;
- for (let i = 0; i < btns.length; i++) {
- btns[i].onclick = function () {
- showGithubStars(btns[i].id);
+ for (let i = 0; i < btns.length; i++) {
+ btns[i].onclick = function () {
+ showGithubStars(btns[i].id);
+ }
}
}
- if (document.getElementById("project-card-holder").children.length != 0) {
+ var projectCardHolder = document.getElementById("project-card-holder");
+ if (projectCardHolder != null && projectCardHolder.children.length != 0) {
projectCards = $(".filtr-projects").filterizr({ layout: 'sameWidth' });
}
@@ -279,6 +286,9 @@ var projectCards;
function showAchievements() {
// show achievements from achievements-holder div
let gallery = document.getElementById("gallery");
+ if (gallery == null) {
+ return
+ }
gallery.innerHTML = "";
const entries = document.getElementById("achievements-holder").children;
let len = entries.length;
diff --git a/static/assets/js/single.js b/static/assets/js/single.js
index f601238d9b6..19d516810a4 100644
--- a/static/assets/js/single.js
+++ b/static/assets/js/single.js
@@ -19,87 +19,19 @@ var isMobile = false, isTablet = false, isLaptop = false;
}
}
detectDevice();
- console.log(isMobile);
- // ======= Add table wrapper ===========
- function adjustPostCardsHeight() {
- if (!isMobile) { // no need to adjust height for mobile devices
- let el = document.getElementById("post-cards").children;
- let maxHeight = 0;
- for (let i = 0; i < el.length; i++) {
- if (el[i].children[0].clientHeight > maxHeight) {
- maxHeight = el[i].children[0].clientHeight;
- }
- }
- for (let i = 0; i < el.length; i++) {
- el[i].children[0].setAttribute("style", "min-height: " + maxHeight + "px;")
- }
- }
+ // =========== Add anchor to the headers ================
+ function addAnchor(element) {
+ element.innerHTML = ``;
}
- adjustPostCardsHeight();
-
- // ============= Sidebar Tre ================
- function buildSidebarMenu() {
- var openedClass = "fa-minus-circle";
- var closedClass = "fa-plus-circle";
- // initialize top level
- var tree = $("#tree");
- // add expand icon to those li who has ul as children
- tree.find("li").has("ul").each(function () {
- var branch = $(this);
- branch.prepend('
');
- branch.on('click', function (e) {
- if (this.children[1] == e.target) {
- // toggle "expand" class and icon
- branch.toggleClass("expand");
- var icon = $(this).children('i:first');
- icon.toggleClass(openedClass + " " + closedClass);
- }
- });
- });
- // remove "expnad" class from siblings of the clicked item
- tree.find("li").on("click", function () {
- var item = $(this);
- var shiblings = item.siblings().each(function () {
- var sibling = $(this);
- if (sibling.hasClass("expand")) {
- sibling.removeClass("expand");
- var icon = sibling.children('i:first');
- icon.toggleClass(openedClass + " " + closedClass);
- }
- });
- });
-
- // focus the cliked item
- tree.find("a").on("click", function () {
- // clear other focused link
- tree.find("a.focused").each(function () {
- $(this).removeClass("focused");
- });
- // focus cliked link
- $(this).addClass("focused");
- });
+ var headerTypes = ["h1", "h2", "h3", "h4", "h5", "h6"];
+ for (var i = 0; i < headerTypes.length; i++) {
+ var headers = document.querySelectorAll(headerTypes[i]);
+ if (headers) {
+ headers.forEach(addAnchor);
+ }
}
- buildSidebarMenu();
- // initialize filterizr
- filterizd = $(".filtr-container").filterizr({ layout: 'sameWidth' });
});
})(jQuery);
-
-// toggle sidebar on click
-function toggleSidebar() {
- document.getElementById("sidebar").classList.toggle("hide");
- document.getElementById("content").classList.toggle("overley");
-
- // if it is mobile device. then scroll to top.
- if (isMobile && $("#sidebar").hasClass("hide")) {
- document.body.scrollTop = 0;
- document.documentElement.scrollTop = 0;
- }
-
- setTimeout(function () {
- filterizd.filterizr('sort');
- }, 300);
-}