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 XML as a support data format #4470

Open
bzerangue opened this issue Mar 4, 2018 · 11 comments
Open

Add XML as a support data format #4470

bzerangue opened this issue Mar 4, 2018 · 11 comments
Labels
Milestone

Comments

@bzerangue
Copy link

@bzerangue bzerangue commented Mar 4, 2018

It would be nice to provide XML as an available data type to load.

Currently, Hugo accepts, TOML, YAML, JSON, and CSV. Is there any reason why XML is NOT amongst the available formats?

It would be great to add XML as an available data type for the /data folder.

@bep bep added the Enhancement label Mar 4, 2018
@rdwatters

This comment has been minimized.

Copy link
Contributor

@rdwatters rdwatters commented Mar 5, 2018

@bzerangue This would be fantastic. Not sure if something like https://github.com/beevik/etree would help said efforts...

@stale

This comment has been minimized.

Copy link

@stale stale bot commented Jul 3, 2018

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@stale stale bot added the Stale label Jul 3, 2018
@stale stale bot closed this Aug 2, 2018
@bep bep reopened this Aug 2, 2018
@stale stale bot removed the Stale label Aug 2, 2018
@bep bep added the Keep label Aug 2, 2018
@fbaube

This comment has been minimized.

Copy link

@fbaube fbaube commented Aug 5, 2018

+1 on this. Type "XML" could then act as a flag to invoke DOCTYPE parsing and optional validation.

@kaushalmodi

This comment has been minimized.

Copy link
Member

@kaushalmodi kaushalmodi commented Nov 6, 2018

Having a getXML similar to getJSON would be useful in creating "planets" from feeds. Ref: https://discourse.gohugo.io/t/anyone-here-interested-in-a-hugo-planet/15092.

It would be great to add XML as an available data type for the /data folder.

Not just the data/ folder, my proposal is to allow remote XML fetching. Once RSS/ATOM feeds can be fetched, we can maintain theme components that do the parsing of the fetched XML feeds.

@bep bep changed the title Add XML as a Data File Type Add XML as a support data format Dec 22, 2018
@bep bep modified the milestones: v0.53, v0.54 Dec 22, 2018
@bep

This comment has been minimized.

Copy link
Member

@bep bep commented Dec 22, 2018

This looks promising: https://github.com/clbanning/mxj

But note that mapping arbitrary XML into a map isn't trivial.

@bep bep modified the milestones: v0.54, v0.55, v0.56 Jan 26, 2019
@stephlocke

This comment has been minimized.

Copy link

@stephlocke stephlocke commented Feb 3, 2019

This'll be great for surfacing RSS from other sources like Medium

@raybellis

This comment has been minimized.

Copy link

@raybellis raybellis commented Mar 22, 2019

+1 from me, too - I'd like to be able to include references from the RFC index, but it's only published in XML format.

@fbaube

This comment has been minimized.

Copy link

@fbaube fbaube commented Apr 29, 2019

I'm working on a Go library to parse mixed content. If anyone can propose an API (i.e. interfaces) that would be useful for Hugo, I could give it a whack.

@stephlocke

This comment has been minimized.

Copy link

@stephlocke stephlocke commented Apr 29, 2019

On the RSS specific side, I currently leverage a site that parses RSS to JSON for consumption

{{ $rssJ := getJSON "https://api.rss2json.com/v1/api.json?rss_url=https%3A%2F%2Fmedium.com%2Ffeed%2Fnightingale-hq" }}


{{ range $rssJ.items }}
    {{ $post := . }}
    <div class="col-12 col-md-6 col-lg-4 mb-2 mr-2 pb-8 blog" style="background-image: url({{ $post.thumbnail }});">
    <a href="{{ $post.link }}" target="_blank" alt="{{ $post.title }}">
    <h2>{{ $post.title }}</h2>
    </a>
    <h3>{{ $post.author }}</h3>
    </div>
{{ end }}
@bep bep modified the milestones: v0.56, v0.57 Jun 14, 2019
@bep bep modified the milestones: v0.57, v0.58 Jul 31, 2019
@bep bep modified the milestones: v0.58, v0.59 Aug 15, 2019
@bep bep removed this from the v0.59 milestone Sep 6, 2019
@bep bep added this to the v0.60 milestone Sep 6, 2019
@bep bep modified the milestones: v0.60, v0.61 Oct 21, 2019
@bep bep modified the milestones: v0.61, v0.62, v0.63 Nov 25, 2019
@bep bep modified the milestones: v0.63, v0.64 Dec 11, 2019
@felicianotech

This comment has been minimized.

Copy link
Contributor

@felicianotech felicianotech commented Jan 16, 2020

If this request is too complex as is, what about simplifying it to a getRSS function? I know for me the need for getXML is simply so that I can have Hugo read in RSS feeds.

@bep bep modified the milestones: v0.64, v0.65 Jan 22, 2020
@bep bep modified the milestones: v0.65, v0.66 Jan 30, 2020
@lhenze

This comment has been minimized.

Copy link

@lhenze lhenze commented Feb 18, 2020

Agreed, this would be fantastic. From the library tech perspective -- we are experimenting with using Hugo to generate Special Collections Finding Aids from Encoded Archival Description (EAD) -- an XML format widely used by libraries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
9 participants
You can’t perform that action at this time.