HeadBuilder Pennington.Head
Collects HeadTags from every contributor. Keyed tags deduplicate by HeadTagKey (first add at a key wins; later same-key adds are dropped) while preserving first-seen order; keyless tags (added via AddRepeatable) always append.
Methods
Add
#public HeadBuilder Add(HeadTagKey key, HeadTag tag)
Adds a tag under an explicit dedup key; the first add at a key wins.
Parameters
keyHeadTagKeytagHeadTag
Returns
HeadBuilderAddRepeatable
#public HeadBuilder AddRepeatable(HeadTag tag)
Adds a repeatable tag (hreflang, JSON-LD, preload) with no deduplication.
Parameters
tagHeadTag
Returns
HeadBuilderBuild
#public IReadOnlyList<HeadEntry> Build()
The composed entries: keyed tags first (first-seen order), then keyless tags (append order).
Returns
IReadOnlyList<HeadEntry>Link
#public HeadBuilder Link(string rel, string href)
Sets a singleton link (e.g. canonical), deduplicated on its rel.
Parameters
relstringhrefstring
Returns
HeadBuilderMeta
#public HeadBuilder Meta(string name, string content)
Sets a named meta tag, deduplicated on its name.
Parameters
namestringcontentstring
Returns
HeadBuilderProperty
#public HeadBuilder Property(string property, string content)
Sets an OpenGraph/property meta tag, deduplicated on its property.
Parameters
propertystringcontentstring
Returns
HeadBuilderTitle
#public HeadBuilder Title(string text)
Sets the document title (deduplicated to one).
Parameters
textstring
Returns
HeadBuilderPennington.Head.HeadBuilder
namespace Pennington.Head;
/// Collects HeadTags from every contributor. Keyed tags deduplicate by HeadTagKey (first add at a key wins; later same-key adds are dropped) while preserving first-seen order; keyless tags (added via AddRepeatable) always append.
public class HeadBuilder
{
/// Adds a tag under an explicit dedup key; the first add at a key wins.
public HeadBuilder Add(HeadTagKey key, HeadTag tag)
;
/// Adds a repeatable tag (hreflang, JSON-LD, preload) with no deduplication.
public HeadBuilder AddRepeatable(HeadTag tag)
;
/// The composed entries: keyed tags first (first-seen order), then keyless tags (append order).
public IReadOnlyList<HeadEntry> Build()
;
/// Sets a singleton link (e.g. canonical), deduplicated on its rel.
public HeadBuilder Link(string rel, string href)
;
/// Sets a named meta tag, deduplicated on its name.
public HeadBuilder Meta(string name, string content)
;
/// Sets an OpenGraph/property meta tag, deduplicated on its property.
public HeadBuilder Property(string property, string content)
;
/// Sets the document title (deduplicated to one).
public HeadBuilder Title(string text)
;
}