forked from ourworld_web/www_template_2023
add newsroom
This commit is contained in:
28
templates/partials/featuredNews.html
Normal file
28
templates/partials/featuredNews.html
Normal file
@@ -0,0 +1,28 @@
|
||||
<body>
|
||||
|
||||
<div class="md:grid md:grid-cols-2 md:gap-8 relative mt-16 lg:mt-16 items-center container mx-auto">
|
||||
<div class="relative lg:ml-8 my-8 w-full md:w-auto">
|
||||
<h3 class="text-base not-italic leading-6 text-gray-600">FEATURED NEWS</h3>
|
||||
<a href={{featured.permalink}} class="">
|
||||
<h2
|
||||
class="mt-8 text-2xl main-title sm:text-3xl md:text-4xl lg:text-5xl fw-500 leading-snug font-normal mb-4 md:mb-10 ">
|
||||
{{ featured.title }}
|
||||
</h2>
|
||||
</a>
|
||||
|
||||
<h4 class="text-sm not-italic font-light leading-6 text-gray-600">
|
||||
{{ featured.date | date(format="%B %e, %Y", timezone="America/Chicago")}} -
|
||||
</h4>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="mx-4 relative lg:mt-0 max-w-full">
|
||||
{% if featured.extra.imgPath %}
|
||||
<img class="relative mx-auto md:w-auto md:max-w-full max-h-80" src={{featured.permalink}}{{featured.extra.imgPath}} alt="" />
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<hr class="mt-6">
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
57
templates/partials/newsCard.html
Normal file
57
templates/partials/newsCard.html
Normal file
@@ -0,0 +1,57 @@
|
||||
<div class="flex flex-col rounded-lg shadow-lg overflow-hidden">
|
||||
<div class="flex-1">
|
||||
<a href={{ post.permalink }} class="block">
|
||||
<div class="flex-shrink-0">
|
||||
{% if post.extra.imgPath %}
|
||||
{% set img_url = get_url(path='/' ~ post.relative_path | replace(from='_', to='-') | replace(from='index.md', to=post.extra.imgPath)) %}
|
||||
<img class="h-48 w-full mx-auto object-cover" src={{img_url}} alt="" />
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="flex-1 bg-white p-4 flex flex-col justify-between">
|
||||
|
||||
<h3 class="mt-2 text-xl leading-7 font-medium text-gray-900 text-left not-italic">
|
||||
{{ post.title }}
|
||||
</h3>
|
||||
{% if post.description %}
|
||||
<p class="mt-3 text-sm font-normal leading-5 text-gray-500 text-left">
|
||||
{{ post.description }}
|
||||
</p>
|
||||
{% endif %}
|
||||
</a>
|
||||
<div class="flex items-center">
|
||||
<div class="flex justify-between items-center">
|
||||
<ul class="list-none flex author-list my-10 mr-2 px-0">
|
||||
{% if post.taxonomies.people %}
|
||||
{% for author in post.taxonomies.people %}
|
||||
{% set author_path = 'people/' ~ author ~ '/index.md' %}
|
||||
{% set people = get_section(path="people/_index.md") %}
|
||||
{% set pages_str = people.pages | json_encode() | as_str %}
|
||||
{% if pages_str is containing(author) %}
|
||||
{% set author = get_page(path=author_path) %}
|
||||
{% set author_img = get_url(path='/' ~ author.relative_path | replace(from='_', to='-') | replace(from='index.md', to=author.extra.imgPath)) %}
|
||||
<li class="author-list-item">
|
||||
<a href="{{ author.permalink }}" tooltip="{{ author.title }}">
|
||||
<img src="{{ author_img }}" alt="{{ author.title }}" class="
|
||||
w-8
|
||||
h-8
|
||||
rounded-full
|
||||
bg-gray-200
|
||||
border-2 border-white
|
||||
" />
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<p class="text-gray-700 text-xs">
|
||||
<time datetime="{{post.date}}">
|
||||
{{ post.date | date(format="%B %e, %Y", timezone="America/Chicago") }}
|
||||
</time>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
70
templates/partials/newsPosts.html
Normal file
70
templates/partials/newsPosts.html
Normal file
@@ -0,0 +1,70 @@
|
||||
{% block content %}
|
||||
|
||||
<div class="text-center main-title px-0 md:w-2/3 lg:w-2/3 mx-8 md:mx-12">
|
||||
<h1
|
||||
class="tracking-tight text-left text-2xl md:text-4xl lg:text-5xl fw-500 leading-snug font-normal mb-10"
|
||||
>
|
||||
{% set path_array = current_path | split(pat="/") %}
|
||||
{% set taxonomy = path_array[1] %}
|
||||
{% set category = path_array[2] %}
|
||||
The Latest from ThreeFold
|
||||
{% if taxonomy == "news-category" %} -
|
||||
{{category | replace(from='-', to=' ' ) | title}}
|
||||
{% endif %}
|
||||
</h1>
|
||||
<div>
|
||||
<div class="mt-12 grid gap-5 max-w-lg mx-auto lg:grid-cols-2 xl:grid-cols-3 lg:max-w-none">
|
||||
{%- for post in paginator.pages %}
|
||||
{% if "Engineering" == "Engineering"%}
|
||||
{% include "partials/newsCard.html" %}
|
||||
{%endif%} {%- endfor %}
|
||||
</div>
|
||||
<hr class="mt-6" />
|
||||
<p class="text-center text-sm mt-2 mb-16">
|
||||
{% if paginator.previous %}
|
||||
<a
|
||||
class="border-transparent"
|
||||
aria-label="First page"
|
||||
href="{{ paginator.first }}"
|
||||
>{% include "partials/icons/svgPrevPageIcon.html" %}{% include
|
||||
"partials/icons/svgPrevPageIcon.html" %}</a
|
||||
>
|
||||
|
||||
<a
|
||||
class="border-transparent"
|
||||
aria-label="Previous page"
|
||||
href="{{ paginator.previous }}"
|
||||
>{% include "partials/icons/svgPrevPageIcon.html" %}</a
|
||||
>
|
||||
|
||||
{% else %} {%
|
||||
include "partials/icons/svgFirstPageIcon.html" %}{% include
|
||||
"partials/icons/svgFirstPageIcon.html" %}
|
||||
{% include
|
||||
"partials/icons/svgFirstPageIcon.html" %}
|
||||
|
||||
{% endif %} {% if
|
||||
paginator.next %}
|
||||
<a
|
||||
class="border-transparent"
|
||||
aria-label="Next page"
|
||||
href="{{ paginator.next }}"
|
||||
>{% include "partials/icons/svgNextPageIcon.html" %}</a
|
||||
>
|
||||
|
||||
<a
|
||||
class="border-transparent"
|
||||
aria-label="Last page"
|
||||
href="{{ paginator.last }}"
|
||||
>{% include "partials/icons/svgNextPageIcon.html" %}{% include
|
||||
"partials/icons/svgNextPageIcon.html" %}</a
|
||||
>
|
||||
{% else %} {% include "partials/icons/svgLastPageIcon.html" %}
|
||||
{% include
|
||||
"partials/icons/svgLastPageIcon.html" %}{% include
|
||||
"partials/icons/svgLastPageIcon.html" %} {% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock content %}
|
38
templates/partials/newsSidebar.html
Normal file
38
templates/partials/newsSidebar.html
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
<div class="mx-8 md:mx-4 flex flex-col">
|
||||
<div class="flex flex-col mb-12 mr-8 lg:mr-24">
|
||||
<h4 class="text-base not-italic font-medium leading-6 text-gray-600 mb-6"> FILTER NEWS BY</h4>
|
||||
<a id="all" class="mb-3 text-black font-normal" href="/newsroom">All</a>
|
||||
{% set taxonomy = get_taxonomy(kind="news-category") %}
|
||||
{% set categories = taxonomy.items %}
|
||||
{% for category in categories %}
|
||||
{% set path = category.name | slugify %}
|
||||
{% set fullpath = "/news-category/" ~ path %}
|
||||
<a id="{{path}}" class="mb-3 text-black font-normal" href={{fullpath}}> {{category.name}} </a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% set section = get_section(path="newsroom/_index.md")%}
|
||||
|
||||
<div class="lg:pt-6 flex flex-col mb-12 w-64 mr-8 lg:mr-24">
|
||||
<h4 class="text-base not-italic font-medium leading-6 text-gray-600 mb-6"> FEATURED NEWS</h4>
|
||||
|
||||
{% for page in section.pages %}
|
||||
{% if page.extra.isFeatured %}
|
||||
<a class="mb-3 text-blue-700" href={{page.permalink}}>{{ page.title }}</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function setActiveCategory() {
|
||||
let activeCategory = window.location.pathname.split("/")[2]
|
||||
if (typeof activeCategory === "undefined") { activeLink = document.getElementById("all") }
|
||||
else { activeLink = document.getElementById(activeCategory)}
|
||||
activeLink.className = activeLink.className.replace("text-black font-normal", "text-black font-semibold");
|
||||
}
|
||||
|
||||
setActiveCategory()
|
||||
</script>
|
Reference in New Issue
Block a user