diff --git a/config.toml b/config.toml index 6eea3f6..c515d04 100644 --- a/config.toml +++ b/config.toml @@ -60,6 +60,12 @@ feed = true paginate_by = 2 paginate_path = "blog-posts" +[[taxonomies]] +name = "items" +feed = true +paginate_by = 2 +paginate_path = "product-posts" + [[taxonomies]] name = "roles" feed = true diff --git a/content/products/realizing_the_promise/index.md b/content/products/realizing_the_promise/index.md index 5b514c6..b2301be 100644 --- a/content/products/realizing_the_promise/index.md +++ b/content/products/realizing_the_promise/index.md @@ -4,7 +4,7 @@ description: "Together with our global community, we're realizing the initial pr date: 2022-03-21T14:40:00-05:00 template: blogPage.html taxonomies: - categories: ["product1"] + items: ["product1"] extra: subtitle: "Together with our global community, we're realizing the initial promise of an open-source, peer-to-peer Internet owned by the people." author: "Sacha Obeegadoo" diff --git a/content/products/tech_as_a_tool_for_humanity/index.md b/content/products/tech_as_a_tool_for_humanity/index.md index 275425c..23a3c61 100644 --- a/content/products/tech_as_a_tool_for_humanity/index.md +++ b/content/products/tech_as_a_tool_for_humanity/index.md @@ -6,7 +6,7 @@ description: While technology has had an important role in the creation of today date: 2022-10-28 taxonomies: tags: [] - categories: [product4] + items: [product4] extra: author: victoria_obeegadoo imgPath: tech_as_a_tool_for_humanity.png diff --git a/content/products/what_is_farming/index.md b/content/products/what_is_farming/index.md index b03044b..ff13559 100644 --- a/content/products/what_is_farming/index.md +++ b/content/products/what_is_farming/index.md @@ -6,7 +6,7 @@ description: A decentralized and energy-efficient way for people to expand a new date: 2022-03-01 taxonomies: tags: [] - categories: [product2] + items: [product2] extra: author: sacha_obeegadoo imgPath: what_is_farming.png diff --git a/content/products/what_is_peer_to_peer/index.md b/content/products/what_is_peer_to_peer/index.md index b8c4715..5ca2127 100644 --- a/content/products/what_is_peer_to_peer/index.md +++ b/content/products/what_is_peer_to_peer/index.md @@ -6,7 +6,7 @@ description: P2P systems are network, not linear or pyramidal hierarchies (tho date: 2020-12-15 taxonomies: tags: [] - categories: [product3] + items: [product3] extra: author: sacha_obeegadoo imgPath: peer_to_peer.png diff --git a/static/js/custom.js b/static/js/custom.js new file mode 100644 index 0000000..176d4b4 --- /dev/null +++ b/static/js/custom.js @@ -0,0 +1,110 @@ +var displayedMenu = ""; +var hamburgerShown = false; +let width = screen.width; +var isMobile = width < 1024; + +function toggleMenu(button) { + if (displayedMenu === button.id.split("-")[0]) { + button.className = button.className.replace( + " text-blue-500 bg-stone-200 sm:bg-transparent", + " text-gray-900" + ); + hideMenu(button.id.split("-")[0]); + button.lastElementChild.className = button.lastElementChild.className.replace( + "rotate-0", + "-rotate-90" + ); + displayedMenu = ""; + } else { + showMenu(button.id.split("-")[0]); + button.lastElementChild.className = button.lastElementChild.className.replace( + "-rotate-90", + "rotate-0" + ); + button.className = button.className.replace( + " text-gray-900", + " text-blue-500 bg-stone-200 sm:bg-transparent" + ); + displayedMenu = button.id.split("-")[0]; + } +} + +function handleClick(button) { + if (button.id === "hamburger-btn" || button.id === "close-hamburger-btn") { + toggleHamburger(); + } + if (button.id.indexOf("menu") !== -1) { + toggleMenu(button); + } +} + +function toggleHamburger() { + if (hamburgerShown) { + hideHamburger(); + hamburgerShown = false; + } else { + showHamburger(); + hamburgerShown = true; + } +} + +function showMenu(menuName) { + var menuId = menuName + (isMobile ? "-mobile-menu" : "-menu"); + var menuBtnId = menuName + (isMobile ? "-mobile-menu" : "-menu"); + var menuElement = document.getElementById(menuId); + menuElement.className = menuElement.className.replace(" hidden", ""); + setTimeout(function () { + menuElement.className = menuElement.className.replace( + "duration-200 ease-in opacity-0 -translate-y-1", + "duration-150 ease-out opacity-1 -translate-y-0" + ); + }, 10); +} + +function hideMenu(menuName) { + var menuId = menuName + (isMobile ? "-mobile-menu" : "-menu"); + var menuElement = document.getElementById(menuId); + menuElement.className = menuElement.className.replace( + "duration-150 ease-out opacity-1 -translate-y-0", + "duration-200 ease-in opacity-0 -translate-y-1" + ); + setTimeout(function () { + menuElement.className = menuElement.className + " hidden"; + }, 300); +} + +function showHamburger() { + document.getElementById("header-container").className = "overflow-hidden"; + document.getElementById("hamburger").className = + "fixed mt-24 z-20 top-0 inset-x-0 transition transform origin-top-right"; + document.getElementById("hamburger-btn").className = + "hidden lg:hidden inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 focus:text-gray-500 transition duration-150 ease-in-out my-2"; + document.getElementById("close-hamburger-btn").className = + "inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 focus:text-gray-500 transition duration-150 ease-in-out my-2"; +} + +function hideHamburger() { + document.getElementById("header-container").className = ""; + document.getElementById("hamburger").className = + "hidden absolute z-20 top-0 inset-x-0 transition transform origin-top-right lg:hidden"; + document.getElementById("hamburger-btn").className = + "inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 focus:text-gray-500 transition duration-150 ease-in-out my-2"; + document.getElementById("close-hamburger-btn").className = + "hidden lg:hidden inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 focus:text-gray-500 transition duration-150 ease-in-out my-2"; + if (displayedMenu !== "") { + hideMenu(displayedMenu); + } +} + +window.onload = function () { + let elements = document.getElementsByTagName("button"); + let buttons = [...elements]; + buttons.forEach((button) => { + button.addEventListener("click", function () { + handleClick(button); + }); + }); + document + .getElementById("mobile-learn-btn") + ?.addEventListener("click", toggleMenu); +}; diff --git a/templates/_default/base.html b/templates/_default/base.html index 8ecfdfb..ffbc538 100644 --- a/templates/_default/base.html +++ b/templates/_default/base.html @@ -9,5 +9,6 @@ {% block content %}{% endblock %} {% include "partials/footer.html" %} + \ No newline at end of file diff --git a/templates/items/list.html b/templates/items/list.html new file mode 100644 index 0000000..f628a84 --- /dev/null +++ b/templates/items/list.html @@ -0,0 +1,4 @@ +{% extends "index.html" %} + +{% block content %} +{% endblock content %} \ No newline at end of file diff --git a/templates/items/single.html b/templates/items/single.html new file mode 100644 index 0000000..19f29a1 --- /dev/null +++ b/templates/items/single.html @@ -0,0 +1,14 @@ +{% extends "index.html" %} + +{% block content %} + +
+ +
+ {% include "partials/productPosts.html" %} + {% include "partials/productSidebar.html" %} +
+
+ + {% endblock content %} + diff --git a/templates/layouts/products.html b/templates/layouts/products.html index 62c113a..5d881c0 100644 --- a/templates/layouts/products.html +++ b/templates/layouts/products.html @@ -11,7 +11,7 @@ and a side nav for category and featured post navigation
- {%- set section = get_section(path="blog/_index.md") %} + {%- set section = get_section(path="products/_index.md") %} {% for page in section.pages %} {% if page.extra.isFeatured %} {%- set_global featured = page %} @@ -19,11 +19,11 @@ and a side nav for category and featured post navigation {% endif %} {% endfor %} - {% include "partials/featuredBlog.html" %} + {% include "partials/featuredProduct.html" %}
- {% include "partials/blogPosts.html" %} - {% include "partials/blogSidebar.html" %} + {% include "partials/productPosts.html" %} + {% include "partials/productSidebar.html" %}
diff --git a/templates/partials/featuredProduct.html b/templates/partials/featuredProduct.html new file mode 100644 index 0000000..63b09ca --- /dev/null +++ b/templates/partials/featuredProduct.html @@ -0,0 +1,36 @@ +{% if featured.taxonomies.people %} + {% set people = get_section(path="people/_index.md") %} + {% set pages_str = people.pages | json_encode() | as_str %} + {% if pages_str is containing(featured.taxonomies.people[0]) %} + {% set author_path = 'people/' ~ featured.taxonomies.people[0] ~ '/index.md' %} + {% set author = get_page(path=author_path) %} + {% endif %} +{% endif %} + + + +
+
+

FEATURED PRODUCT

+ +

+ {{ featured.title }} +

+
+

+ {{ featured.date | date(format="%B %e, %Y", timezone="America/Chicago")}} - +

+ +
+ +
+ +
+
+ +
+ + + + \ No newline at end of file diff --git a/templates/partials/header.html b/templates/partials/header.html index 513852d..94fd1f3 100644 --- a/templates/partials/header.html +++ b/templates/partials/header.html @@ -3,87 +3,6 @@ Read the documentation to get started: https://tailwindui.com/documentation --> - - {% set section = get_section(path="_index.md") %} diff --git a/templates/partials/header_custom.html b/templates/partials/header_custom.html index 7b32fc8..1e50ca3 100644 --- a/templates/partials/header_custom.html +++ b/templates/partials/header_custom.html @@ -3,87 +3,6 @@ Read the documentation to get started: https://tailwindui.com/documentation --> - - {%- set section = get_section(path="header/_index.md") %} {% set header_items = section.content | safe | split(pat="
  • ") %} diff --git a/templates/partials/productCard.html b/templates/partials/productCard.html new file mode 100644 index 0000000..b70123c --- /dev/null +++ b/templates/partials/productCard.html @@ -0,0 +1,75 @@ +{% if post.date %} +{% if post.taxonomies.people %} +{% set people = get_section(path="people/_index.md") %} +{% set pages_str = people.pages | json_encode() | as_str %} +{% if pages_str is containing(post.taxonomies.people[0]) %} +{% set author_path = 'people/' ~ post.taxonomies.people[0] ~ '/index.md' %} +{% set author = get_page(path=author_path) %} +{% set content = get_page(path=author_path) %} +{% endif %} +{% endif %} + +
    + +
    + + +{% endif %} \ No newline at end of file diff --git a/templates/partials/productPosts.html b/templates/partials/productPosts.html new file mode 100644 index 0000000..862f041 --- /dev/null +++ b/templates/partials/productPosts.html @@ -0,0 +1,70 @@ +{% block content %} + +
    +

    + {% set path_array = current_path | split(pat="/") %} + {% set taxonomy = path_array[1] %} + {% set item = path_array[2] %} + The Latest from OurPhone + {% if taxonomy == "items" %} - + {{item | replace(from='-', to=' ' ) | title}} + {% endif %} +

    +
    +
    + {%- for post in paginator.pages %} + {% if not post.extra.hidden %} + {% include "partials/productCard.html" %} + {%endif%} {%- endfor %} +
    +
    +

    + {% if paginator.previous %} + {% include "partials/icons/svgPrevPageIcon.html" %}{% include + "partials/icons/svgPrevPageIcon.html" %} +           + {% include "partials/icons/svgPrevPageIcon.html" %} +           +           {% else %} {% + include "partials/icons/svgFirstPageIcon.html" %}{% include + "partials/icons/svgFirstPageIcon.html" %} +           {% include + "partials/icons/svgFirstPageIcon.html" %} +           +           {% endif %} {% if + paginator.next %} + {% include "partials/icons/svgNextPageIcon.html" %} +           + {% include "partials/icons/svgNextPageIcon.html" %}{% include + "partials/icons/svgNextPageIcon.html" %} + {% else %} {% include "partials/icons/svgLastPageIcon.html" %} +           {% include + "partials/icons/svgLastPageIcon.html" %}{% include + "partials/icons/svgLastPageIcon.html" %} {% endif %} +

    +
    +
    + +{% endblock content %} \ No newline at end of file diff --git a/templates/partials/productSidebar.html b/templates/partials/productSidebar.html new file mode 100644 index 0000000..e450ad7 --- /dev/null +++ b/templates/partials/productSidebar.html @@ -0,0 +1,38 @@ + +
    +
    +

    FILTER PRODUCTS BY

    + All + {% set taxonomy = get_taxonomy(kind="items") %} + {% set items = taxonomy.items %} + {% for item in items %} + {% set path = item.name | slugify %} + {% set fullpath = "/items/" ~ path %} + {{item.name}} + {% endfor %} +
    + +{% set section = get_section(path="products/_index.md")%} + +
    +

    FEATURED POSTS

    + + {% for page in section.pages %} + {% if page.extra.isFeatured %} + {{ page.title }} + {% endif %} + {% endfor %} + +
    +
    + + \ No newline at end of file diff --git a/templates/productPage.html b/templates/productPage.html index e5decb9..e93e750 100644 --- a/templates/productPage.html +++ b/templates/productPage.html @@ -12,12 +12,12 @@ -{% set split = page.content | split(pat="threefold.io") %} +{% set split = page.content | split(pat="ourphone.tf") %} {% if split | length < 2 %} {% set content=page.content %} {% else %} {% set content="" %} {% for part in split %} {% if - part is starting_with("/blog") %} {% set split_part=part | split(pat='/">' ) %} {% set link=split_part[0] %} {% set - link=link | replace(from="/blog/post" , to="/blog" ) %} {% set link=link | replace(from="_" , to="-" ) %} {% set + part is starting_with("/product") %} {% set split_part=part | split(pat='/">' ) %} {% set link=split_part[0] %} {% set + link=link | replace(from="/product/post" , to="/product" ) %} {% set link=link | replace(from="_" , to="-" ) %} {% set rest_part=split_part | slice(start=1) | join(sep='/"' ) %} {% set part=link ~ '/">' ~ rest_part %} {% endif %} {% if - loop.first %} {% set_global content=part%} {% else %} {% set_global content=content ~ "threefold.io" ~ part%} {% endif + loop.first %} {% set_global content=part%} {% else %} {% set_global content=content ~ "ourphone.tf" ~ part%} {% endif %} {% endfor %} {% endif %}