Skip to content
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

Feat: empty image check #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion component-library/components/cards/cards.eleventy.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% for card in cards %}
<div class="card">
<div class="media">
{% image card.media.url card.media.alt 500 %}
{% image card.media.image.url card.media.image.alt 500 %}
</div>
<div class="text">
<h3>
Expand Down
2 changes: 1 addition & 1 deletion eleventy.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(svgContents);

eleventyConfig.addShortcode("image", async function (src, alt, widths, sizes) {
if (src === undefined) {
if (src === undefined || src === null) {
return "";
}

Expand Down
18 changes: 6 additions & 12 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,24 @@
cards:
- media:
image:
url: ''
alt: ''
url: /assets/campus.jpg
alt: Campus
url: /assets/campus.jpg
alt: Campus
heading:
text: Admissions
url: '#'
text: Learn more about the admissions process and how to apply.
- media:
image:
url: ''
alt: ''
url: /assets/lecture.jpg
alt: Lecture hall
url: /assets/lecture.jpg
alt: Lecture hall
heading:
text: Academics
url: '#'
text: Explore our academic programs and departments.
- media:
image:
url: ''
alt: ''
url: /assets/research.jpg
alt: Research lab
url: /assets/research.jpg
alt: Research lab
heading:
text: Research
url: '#'
Expand Down