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

๐Ÿ–ผ๏ธ Add cover image to content layout #558

Merged
merged 1 commit into from
Jan 12, 2023
Merged
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
13 changes: 12 additions & 1 deletion components/Layout.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
<template>
<div>
<div
v-if="imageSrc"
class="flex items-center max-h-72 overflow-hidden"
>
<img
:src="imageSrc"
aria-hidden="true"
class="object-cover m-0"
>
</div>
<div class="relative mx-auto flex max-w-8xl justify-center sm:px-2 lg:px-8 xl:px-12">
<div class="min-w-0 max-w-2xl flex-auto px-4 py-16 lg:max-w-none lg:pr-0 lg:pl-8 xl:px-16">
<div class="min-w-0 max-w-2xl flex-auto px-4 pb-16 pt-8 lg:pt-16 lg:max-w-none lg:pr-0 lg:pl-8 xl:px-16">
<article>
<header
v-if="title || section"
Expand Down Expand Up @@ -85,6 +95,7 @@ import { ref, onMounted, onUnmounted } from 'vue';
const { path } = useRoute();
const contentPath = path.endsWith('/') ? path.slice(0, -1) : path;
const contentDirectory = await queryContent().where({ _path: contentPath }).findOne();
const imageSrc = contentDirectory.img;
const title = contentDirectory.title;
const navigation = await fetchContentNavigation();
const section = navigation.find((s) =>
Expand Down
1 change: 1 addition & 0 deletions content/guides/farmlands-pos-integration.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Farmlands POS Integration Guide
img: /farmlands-pos-integration-cover.jpg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was your reasoning for using a JPG over a PNG? I see the other image you used was a PNG

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tom-blake I went to Unsplash and got the original image as the one from Figma wasn't large enough. Unsplash didn't have an option for the file type and downloaded it as a JPG.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see - thanks! Maybe let the designers know if Unsplash isn't what they'd do :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MeganSteenkamp I think it's good that you used the front-matter to declare the image path, @AndyClifford will need this path to display this guide as a small card on the partner page ๐Ÿ‘

Is there a reason why it doesn't need to be the full path (include /public)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to use the assets directory here? ~/assets/farmlands/pos-integration-cover.jpg

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tom-blake @AndyClifford I have tried the assets directory but it didn't work ๐Ÿค”. By default files in the /public directory are served at the root which is why I didn't need to specify the folder.

I see Nuxt has an image module if we did want to optimize images: https://v1.image.nuxtjs.org/get-started/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MeganSteenkamp Yeah it's not working for me either. Found this comment that suggests copying the files to public or using the module you mentioned

---

Centrapay and Farmlands have entered into a partnership that will allow Farmlands Card Partners to accept the Farmlands Card for payment at the point of sale. The benefits include real-time balance checks, the elimination of reconciliation EDI files, and it unlocks the ability to accept many more payment methods on the Centrapay platform.
Expand Down
Binary file added public/farmlands-pos-integration-cover.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.