There is an existing port patch to Drupal 8 of Contact Info module which generates an hcard for the entire site. I tested it and I believe it's generating the right markup via Twig. Patch here: #2624866: D8 port

I think it would make sense to create a submodule called microformats_hcard_site which would implement this.

Not necessary for an initial commit but in general I think it would be best for modularity if the parent microformats module - or possibly another submodule - could generate hcard objects for best consistency.

For generating these objects could it be like a plugin factory architecture? Extending something like:
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Plugin!Facto...
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Component%21Plug...

Comments

HongPong created an issue. See original summary.

hongpong’s picture

Issue summary: View changes
hongpong’s picture

New module microformats_hcard_site is almost working here
https://github.com/HongPong/microformats/tree/hcard_sitewide
but the block is not working yet. It does save its config settings. Very close now.

hongpong’s picture

Status: Active » Needs work
hongpong’s picture

Related issues: +#2624866: D8 port
hongpong’s picture

hcard code is available here #2624866: D8 port , thinking it would make sense to put into this module. especially as there hasn't been movement on that module for 8 yet.

hongpong’s picture

Starting out by importing the awesome work from karthikeyan-manivasagam via here https://github.com/karthikeyan-manivasagam/contactinfo

Still rough but it's a place to start from

  • 10f04cd committed on 8.x-1.x
    Issue #2720199 by karthikeyan-manivasagam, adapted by HongPong: Starting...
hongpong’s picture

Patch puts it in much better shape, theme function is close.

  • HongPong committed 5aeb2cf on 8.x-1.x
    Issue #2720199 by HongPong: Sitewide hcards for D8, config admin form...
  • HongPong committed adad30b on 8.x-1.x
    Issue #2720199, #2928810 by HongPong, ritzz: Sitewide hcards for D8,...

  • HongPong committed 48fa51c on 8.x-1.x
    Issue #2720199 by HongPong. typo on config element
    
mlncn’s picture

Note that patches and code mentioned have been committed.

Theme function is still empty.

I could take this on; is there any in-progress code to push?

The idea is to automatically create a theme function with all the variables from the configuration options, rather than hard-code it, yes?

hongpong’s picture

yes but probably everything here got superseded by https://www.drupal.org/project/indieweb which is kind of taking the Swiss army approach to this stuff.

mlncn’s picture

Yeah, i had looked— the microformats hcard stuff is not advertized as being done at all, but i'll take a closer look at the code here. You'd prefer feature requests go there?

mlncn’s picture

OK per the indieweb README:

Your homepage should contain a h-card entry. This module does not expose this for you (yet). An example:

  <p class="h-card">My name is <a class="u-url p-name" rel="me" href="/">Your name</a>

So yeah, they don't yet have microformats-like functionality, but seem open to it.

mlncn’s picture

Anyhow, for now here's a version of the microformats module with a working sitewide contact info block.

mlncn’s picture

Status: Needs work » Needs review

  • HongPong committed 2fee89b on 8.x-1.x authored by mlncn
    Issue #3099627 #2720199 #3094750  Combine agaric mlncn work into main...
hongpong’s picture

Status: Needs review » Fixed

Calling it fixed yay

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.