Coder Social home page Coder Social logo

Comments (5)

toudi avatar toudi commented on May 29, 2024 1

sorry for necrobumping, but I've read the linked articles and I still do not understand how can I add images to posts (I'm receiving exactly the same error as the OP). what I've tried so far:

  • editing images array inside _index.md
  • adding resources section inside _index.md, like so:
resources:
- src: 'images/my-image.png'
  • trying to place the image in the same directory as the .md file, without images subdirectory

basically my directory structure is exactly the same as cloning doks repository and I simply cannot build the page when I'm trying to place the image.

the change that I did is:

--- a/content/docs/prologue/introduction.md
+++ b/content/docs/prologue/introduction.md
@@ -5,7 +5,7 @@ lead: "Doks is a Hugo theme helping you build modern documentation websites that
 date: 2020-10-06T08:48:57+00:00
 lastmod: 2020-10-06T08:48:57+00:00
 draft: false
-images: []
+images: ["unnamed.png"]
+resources:
+  - "unnamed.png"
 menu:
   docs:
     parent: "prologue"
@@ -19,6 +19,8 @@ There are two main ways to get started with Doks:
 
 ### Tutorial
 
+{{< img-simple src="unnamed.png" >}}

(the image is placed inside content/docs/prologue directory.

would it be possible for you to provide a quick tutorial on adding images? I can see that this works in the minecraft demo page, though I can't even see where the images are referenced - they simply seem to be referenced trough img tag.

from doks.

toudi avatar toudi commented on May 29, 2024 1

wow! it works like a charm. Thank you so much!

from doks.

h-enk avatar h-enk commented on May 29, 2024

Hey @alexvpickering, you need to use Page Bundles for the image shortcodes to work β€” see also Images.

You found a bug though πŸ˜‰ I will update the hyas info command β€” it should be npm run check.

from doks.

alexvpickering avatar alexvpickering commented on May 29, 2024

Hey @alexvpickering, you need to use Page Bundles for the image shortcodes to work β€” see also Images.

You found a bug though πŸ˜‰ I will update the hyas info command β€” it should be npm run check.

Ahhh okay great thank you! I had originally followed the Page Bundles link but it was too verbose for my state of mind so I assumed it was just a β€œgo ahead and put images with you pages”. I’ll read the docs this time 😊

from doks.

h-enk avatar h-enk commented on May 29, 2024

Hello @toudi, the image shortcodes work for images that are page resources. Meaning, place your images in a page folder, like so:

..
β”œβ”€β”€ prologue/
β”‚   β”œβ”€β”€ _index.md
β”‚   β”œβ”€β”€ commands.md
β”‚   β”œβ”€β”€ introduction/
β”‚   β”‚   β”œβ”€β”€ index.md
β”‚   β”‚   └── unnamed.png
β”‚   └── quick-start.md
..

That's it.

from doks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.