Skip to content

Replace hero image with carousel slider #529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,42 @@
{% endif %}
{% endfor %}
{% endif %}
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
</head>

<body>
{%- include header.html -%}
<header>
<div id="postSlider" class="carousel slide slider-container" data-bs-ride="carousel">
<div class="carousel-inner">
{% for post in site.posts %}
<div class="carousel-item {% if forloop.first %}active{% endif %}">
<div class="email-circle">
<img src="{{ post.featured_image | default: post.content | split: '!' | first | split: '(' | last | split: ')' | first | default: 'default-image.jpg' }}" alt="{{ post.title }}">
</div>
<h3 class="post-title">{{ post.title }}</h3>
<p class="post-summary">{{ post.excerpt | strip_html | truncatewords: 20 }}</p>
</div>
{% endfor %}
</div>

<!-- Controls -->
<button class="carousel-control-prev" type="button" data-bs-target="#postSlider" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#postSlider" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
</header>
<main class="container" role="main" aria-label="Content">
{{ content }}
</main>
{%- include footer.html -%}
<script src="{{ '/assets/js/index.js' | relative_url }}"></script>
<script src="https://kit.fontawesome.com/1bbe56de49.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
4 changes: 0 additions & 4 deletions _layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
layout: default
---
<div class="home">
{% assign t = site.data.locales[page.lang][page.lang] %} {% if page.title %} {% assign header = page.title %} {% else %} {% assign header = site.title %} {% endif %}
<article class="hero">
<div class="hero-text">{{ t.index.lead }}</div>
</article>
{{ content }}

<img src="{{'/assets/images/dcus.jpg' | relative_url }}" alt="DjangoCon US 2023"/>
Expand Down
48 changes: 48 additions & 0 deletions assets/css/bpd.css
Original file line number Diff line number Diff line change
Expand Up @@ -517,3 +517,51 @@ ul.speaking-list {
max-width: 60%;
}
}

header {
padding: 40px 20px;
margin-bottom: 20px;
/* background-color: black; */
}
.slider-container {
min-height: 300px;
display: flex;
justify-content: center;
align-items: center;
/* background-image: url("/assets/images/hero-bpd-background.jpg"); */
background-color: #222;
padding: 40px;
border-radius: 10px;
margin: 0 auto;
width: 85%;
/* max-width: 1000px; */
}
.email-circle {
width: 200px;
height: 200px;
background-color: #fff;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
margin: 0 auto 15px;
overflow: hidden;
}
.email-circle img {
width: 100%;
height: 100%;
object-fit: cover;
}
.carousel-item {
text-align: center;
}
.post-title {
font-size: 25px;
font-weight: bold;
color: white;
margin-bottom: 10px;
}
.post-summary {
font-size: 15px;
color: #f1f1f1;
}
Loading