Skip to content

Commit 73fb807

Browse files
Merge pull request #1 from okeneo/add-main-page
add project preview
2 parents 571c90f + 17301ea commit 73fb807

File tree

9 files changed

+76
-1071
lines changed

9 files changed

+76
-1071
lines changed

_config.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ pwa:
147147
deny_paths:
148148
# - "/example" # URLs match `<SITE_URL>/example/*` will not be cached by the PWA
149149

150-
paginate: 10
150+
# Remove or comment out the paginate setting
151+
# paginate: 10
151152

152153
# The base URL of your site
153154
baseurl: ""
@@ -174,14 +175,16 @@ collections:
174175
defaults:
175176
- scope:
176177
path: "" # An empty string here means all files in the project
177-
type: posts
178+
type: pages
178179
values:
179-
layout: post
180-
comments: true # Enable comments in posts.
181-
toc: true # Display TOC column in posts.
182-
# DO NOT modify the following parameter unless you are confident enough
183-
# to update the code of all other post links in this project.
184-
permalink: /posts/:title/
180+
layout: page
181+
comments: false
182+
toc: false
183+
title: Project Overview # Rename Home to Project Overview
184+
- scope:
185+
path: _posts # Exclude posts from the homepage
186+
values:
187+
layout: none
185188
- scope:
186189
path: _drafts
187190
values:

_layouts/home.html

Lines changed: 27 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -5,118 +5,30 @@
55

66
{% include lang.html %}
77

8-
{% assign all_pinned = site.posts | where: 'pin', 'true' %}
9-
{% assign all_normal = site.posts | where_exp: 'item', 'item.pin != true and item.hidden != true' %}
10-
11-
{% assign posts = '' | split: '' %}
12-
13-
<!-- Get pinned posts on current page -->
14-
15-
{% assign visible_start = paginator.page | minus: 1 | times: paginator.per_page %}
16-
{% assign visible_end = visible_start | plus: paginator.per_page %}
17-
18-
{% if all_pinned.size > visible_start %}
19-
{% if all_pinned.size > visible_end %}
20-
{% assign pinned_size = paginator.per_page %}
21-
{% else %}
22-
{% assign pinned_size = all_pinned.size | minus: visible_start %}
23-
{% endif %}
24-
25-
{% for i in (visible_start..all_pinned.size) limit: pinned_size %}
26-
{% assign posts = posts | push: all_pinned[i] %}
27-
{% endfor %}
28-
{% else %}
29-
{% assign pinned_size = 0 %}
30-
{% endif %}
31-
32-
<!-- Get normal posts on current page -->
33-
34-
{% assign normal_size = paginator.posts | size | minus: pinned_size %}
35-
36-
{% if normal_size > 0 %}
37-
{% if pinned_size > 0 %}
38-
{% assign normal_start = 0 %}
39-
{% else %}
40-
{% assign normal_start = visible_start | minus: all_pinned.size %}
41-
{% endif %}
42-
43-
{% assign normal_end = normal_start | plus: normal_size | minus: 1 %}
44-
45-
{% for i in (normal_start..normal_end) %}
46-
{% assign posts = posts | push: all_normal[i] %}
47-
{% endfor %}
48-
{% endif %}
49-
50-
<div id="post-list" class="flex-grow-1 px-xl-1">
51-
{% for post in posts %}
52-
<article class="card-wrapper card">
53-
<a href="{{ post.url | relative_url }}" class="post-preview row g-0 flex-md-row-reverse">
54-
{% assign card_body_col = '12' %}
55-
56-
{% if post.image %}
57-
{% assign src = post.image.path | default: post.image %}
58-
{% unless src contains '//' %}
59-
{% assign src = post.media_subpath | append: '/' | append: src | replace: '//', '/' %}
60-
{% endunless %}
61-
62-
{% assign alt = post.image.alt | xml_escape | default: 'Preview Image' %}
63-
64-
{% assign lqip = null %}
65-
66-
{% if post.image.lqip %}
67-
{% capture lqip %}lqip="{{ post.image.lqip }}"{% endcapture %}
68-
{% endif %}
69-
70-
<div class="col-md-5">
71-
<img src="{{ src }}" alt="{{ alt }}" {{ lqip }}>
72-
</div>
73-
74-
{% assign card_body_col = '7' %}
75-
{% endif %}
76-
77-
<div class="col-md-{{ card_body_col }}">
78-
<div class="card-body d-flex flex-column">
79-
<h1 class="card-title my-2 mt-md-0">{{ post.title }}</h1>
80-
81-
<div class="card-text content mt-0 mb-3">
82-
<p>{% include post-description.html %}</p>
83-
</div>
84-
85-
<div class="post-meta flex-grow-1 d-flex align-items-end">
86-
<div class="me-auto">
87-
<!-- posted date -->
88-
<i class="far fa-calendar fa-fw me-1"></i>
89-
{% include datetime.html date=post.date lang=lang %}
90-
91-
<!-- categories -->
92-
{% if post.categories.size > 0 %}
93-
<i class="far fa-folder-open fa-fw me-1"></i>
94-
<span class="categories">
95-
{% for category in post.categories %}
96-
{{ category }}
97-
{%- unless forloop.last -%},{%- endunless -%}
98-
{% endfor %}
99-
</span>
100-
{% endif %}
101-
</div>
102-
103-
{% if post.pin %}
104-
<div class="pin ms-1">
105-
<i class="fas fa-thumbtack fa-fw"></i>
106-
<span>{{ site.data.locales[lang].post.pin_prompt }}</span>
107-
</div>
108-
{% endif %}
109-
</div>
110-
<!-- .post-meta -->
111-
</div>
112-
<!-- .card-body -->
113-
</div>
114-
</a>
115-
</article>
116-
{% endfor %}
117-
</div>
118-
<!-- #post-list -->
119-
120-
{% if paginator.total_pages > 1 %}
121-
{% include post-paginator.html %}
122-
{% endif %}
8+
{% comment %}
9+
This layout is used for the homepage.
10+
{% endcomment %}
11+
<!DOCTYPE html>
12+
<html lang="{{ site.lang }}">
13+
<head>
14+
{% include head.html %}
15+
<title>Project Overview</title>
16+
</head>
17+
<body>
18+
<div class="container">
19+
<header>
20+
<h1>Project Overview</h1>
21+
</header>
22+
<main id="main">
23+
{% assign main_page = site.pages | where: "path", "main-page.md" | first %}
24+
{% if main_page %}
25+
{{ main_page.content }}
26+
{% else %}
27+
<p>Main page content not found.</p>
28+
{% endif %}
29+
</main>
30+
<!-- Remove Recently Updated and Trending Tags sections -->
31+
</div>
32+
{% include footer.html %}
33+
</body>
34+
</html>

_layouts/post.html

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,6 @@ <h1 data-toc-skip>{{ page.title }}</h1>
2222
{% endif %}
2323

2424
<div class="post-meta text-muted">
25-
<!-- published date -->
26-
<span>
27-
{{ site.data.locales[lang].post.posted }}
28-
{% include datetime.html date=page.date tooltip=true lang=lang %}
29-
</span>
30-
31-
<!-- lastmod date -->
32-
{% if page.last_modified_at and page.last_modified_at != page.date %}
33-
<span>
34-
{{ site.data.locales[lang].post.updated }}
35-
{% include datetime.html date=page.last_modified_at tooltip=true lang=lang %}
36-
</span>
37-
{% endif %}
38-
3925
{% if page.image %}
4026
{% capture src %}src="{{ page.image.path | default: page.image }}"{% endcapture %}
4127
{% capture class %}class="preview-img{% if page.image.no_bg %}{{ ' no-bg' }}{% endif %}"{% endcapture %}
@@ -52,49 +38,6 @@ <h1 data-toc-skip>{{ page.title }}</h1>
5238
{%- endif -%}
5339
</div>
5440
{% endif %}
55-
56-
<div class="d-flex justify-content-between">
57-
<!-- author(s) -->
58-
<span>
59-
{% if page.author %}
60-
{% assign authors = page.author %}
61-
{% elsif page.authors %}
62-
{% assign authors = page.authors %}
63-
{% endif %}
64-
65-
{{ site.data.locales[lang].post.written_by }}
66-
67-
<em>
68-
{% if authors %}
69-
{% for author in authors %}
70-
{% if site.data.authors[author].url -%}
71-
<a href="{{ site.data.authors[author].url }}">{{ site.data.authors[author].name }}</a>
72-
{%- else -%}
73-
{{ site.data.authors[author].name }}
74-
{%- endif %}
75-
{% unless forloop.last %}{{ '</em>, <em>' }}{% endunless %}
76-
{% endfor %}
77-
{% else %}
78-
<a href="{{ site.social.links[0] }}">{{ site.social.name }}</a>
79-
{% endif %}
80-
</em>
81-
</span>
82-
83-
<div>
84-
<!-- pageviews -->
85-
{% if site.pageviews.provider and site.analytics[site.pageviews.provider].id %}
86-
<span>
87-
<em id="pageviews">
88-
<i class="fas fa-spinner fa-spin small"></i>
89-
</em>
90-
{{ site.data.locales[lang].post.pageview_measure }}
91-
</span>
92-
{% endif %}
93-
94-
<!-- read time -->
95-
{% include read-time.html content=content prompt=true lang=lang %}
96-
</div>
97-
</div>
9841
</div>
9942
</header>
10043

0 commit comments

Comments
 (0)