Skip to content

How to add a background image to a post? #988

Discussion options

You must be logged in to vote

I figured it out:

{{ if .Params.imgbg -}}
  {{- range first 1 .Params.imgbg -}}
	<style>.post-content {background-image: url('{{. | absURL}}');}</style>
  {{- end -}}
{{- end -}}

and then giving the image path in imgbg in post header ...
Sorry for the inconvenience.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@JingyiWu-codespace
Comment options

Answer selected by sahashirshendu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants