An open API service indexing awesome lists of open source software.

https://github.com/devidw/hugo-theme-component-oembed

Static oEmbed endpoint for Hugo websites
https://github.com/devidw/hugo-theme-component-oembed

endpoint hugo hugo-theme-component json oembed static

Last synced: 3 months ago
JSON representation

Static oEmbed endpoint for Hugo websites

Awesome Lists containing this project

README

        

= Hugo Theme Component: oEmbed
David Wolf

Add a static oEmbed endpoint to your hugo website by generating a oEmbed file for each of your posts.

Currently supported oEmbed content types:

* `link`

== Installation
Add the theme component as submodule to your hugo prject:

[source,zsh]
----
git submodule add https://github.com/devidw/hugo-theme-component-oembed.git ./themes/hugo-theme-component-oembed
----

// == Configuration
// …

== Setup
Specify the output format in your `config.yaml` file:

[source,yaml]
----
outputFormats:
# hugo-theme-component-oembed
oembed:
name: "oembed"
baseName: "oembed"
mediaType: "application/json"
isPlainText: true
----

Also add the output format to the `outputs` array:

[source,yaml]
----
outputs:
home:
# …
- OEMBED # hugo-theme-component-oembed
page:
# …
- OEMBED # hugo-theme-component-oembed
----

Include the `oembed.html` partial in the `` of you themes template file, for example `baseof.html`:

[source,go]
----
{{/* hugo-theme-component-oembed */}}
{{ partial "oembed.html" . }}
----

This will create a link like the following on page build:

[source, html]
----

----

== Usage
Exlude a page from the oEmbed output:

[source,yaml]
----
notoembed: true
----

== Resources
* https://oembed.com[oEmbed]
* https://halfelf.org/2021/oembedding-hugo/[oEmbedding Hugo]