Set-Metadata
2 minute read
Set-Metadata
SYNOPSIS
Overwrites the metadata frontmatter in a Markdown file.
SYNTAX
Set-Metadata [-Path] <string> [-NewMetadata] <hashtable> [-Recurse] [<CommonParameters>]
DESCRIPTION
Overwrites the metadata frontmatter in a Markdown file. The existing frontmatter is replaced with the values in the NewMetadata hashtable.
EXAMPLES
Example 1 - Replace the existing metadata with new values
$newvalues = @{
'ms.date' = Get-Date -Format 'MM/dd/yyyy'
test='foo'
}
Update-Metadata .\docs\*.md -NewMetadata $newvalues
PARAMETERS
-NewMetadata
This is a hashtable of key-value pairs to be written to the Markdown file.
Type: System.Collections.Hashtable
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Path
The path to the Markdown file. This can be a path to a folder containing Markdown files. Wildcards are allowed.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: True
-Recurse
Cause the cmdlet to recursively search for Markdown files in the matching Path and all subfolders.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.