FOAF with Hugo View article history Edit article

Published: , Updated:
Talks about: <a class="post-tag post-tag-foaf" href="/tags/foaf">foaf</a>, and <a class="post-tag post-tag-hugo" href="/tags/hugo">hugo</a>

To publish a FOAF document with your Hugo site, configure a media type in your config.toml:

  suffixes = ["rdf"]
  name = "FOAF"
  mediaType = "application/rdf+xml"
  baseName = "foaf"
  isPlainText = false
  rel = "alternate"
  isHTML = false
  noUgly = true
  permalinkable = false

Create a new layout in _default/home.foaf.rdf with the following content:

<rdf:RDF xmlns:rdf="" xmlns:rdfs="" xmlns:foaf="">
  <foaf:PersonalProfileDocument rdf:about="">
    <foaf:maker rdf:resource="#me" />
    <foaf:primaryTopic rdf:resource="{{ .Site.Title }}" />

  <foaf:Project rdf:ID="{{ .Site.Title }}">
    <foaf:name>{{ .Site.Title }}</foaf:name>
    <foaf:homepage rdf:resource="{{ .Site.BaseURL }}" />

  {{ range $.Site.Data.contributors }}
  <foaf:Person rdf:ID="{{ .id }}">
    <foaf:name>{{ .first_name }} {{ .last_name }}</foaf:name>
    <foaf:title>{{ .title }}</foaf:title>
    <foaf:givenname>{{ .first_name }}</foaf:givenname>
    <foaf:family_name>{{ .last_name }}</foaf:family_name>
    <foaf:mbox rdf:resource="mailto:{{ .email }}" />
    <foaf:homepage rdf:resource="{{ .website }}" />
  {{ end }}