Skip to content

Commit 9f9aa4a

Browse files
Yuxuan HouYuxuan Hou
authored andcommitted
1
1 parent c470866 commit 9f9aa4a

2 files changed

Lines changed: 23 additions & 5 deletions

File tree

_layouts/about.html

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,18 @@
33
---
44

55
<!-- about.html -->
6-
<div class="post">
6+
{% assign has_profile_image = false %}
7+
{% assign profile_image_path = nil %}
8+
{% if page.profile and page.profile.image %}
9+
{% assign profile_image_path = page.profile.image | prepend: 'assets/img/' %}
10+
{% assign profile_image_static_path = profile_image_path | prepend: '/' %}
11+
{% assign profile_image_file = site.static_files | where: "path", profile_image_static_path | first %}
12+
{% if profile_image_file %}
13+
{% assign has_profile_image = true %}
14+
{% endif %}
15+
{% endif %}
16+
17+
<div class="post{% if has_profile_image %} post-with-profile-image{% endif %}">
718
<header class="about-header">
819
<h1 class="about-title">
920
{% if site.title == "blank" -%} {{ site.first_name }} {{ site.middle_name }} <span class="font-weight-bold">{{ site.last_name }}</span>{%- else -%}{{ site.title }}{%- endif %}
@@ -12,11 +23,9 @@ <h1 class="about-title">
1223
</header>
1324

1425
<article>
15-
{% if page.profile -%}
26+
{% if page.profile and (has_profile_image or page.profile.address) -%}
1627
<div class="profile float-{%- if page.profile.align == 'left' -%}left{%- else -%}right{%- endif -%}">
17-
{%- if page.profile.image %}
18-
{%- assign profile_image_path = page.profile.image | prepend: 'assets/img/' -%}
19-
28+
{%- if has_profile_image %}
2029
{% if page.profile.image_circular %}
2130
{%- assign profile_image_class = "img-fluid z-depth-1 rounded-circle" -%}
2231
{% else %}

_sass/_base.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,15 @@ blockquote {
145145
margin-right: 1rem;
146146
}
147147

148+
.post:not(.post-with-profile-image) {
149+
.profile {
150+
width: 100%;
151+
margin-left: 0;
152+
margin-right: 0;
153+
float: none;
154+
}
155+
}
156+
148157
@media (min-width: 576px) {
149158
.profile {
150159
width: 30%;

0 commit comments

Comments
 (0)