Beispiel #1
0
        /// <summary>
        /// Returns the value, if any, for a specified field name. It takes the value from the FrontMatter only.
        /// If it's not present in the Front Matter, it returns the default value.
        /// </summary>
        /// <param name="name">The name of the field to retrieve</param>
        /// <param name="md">An optional Markdown file to check in its front matter</param>
        /// <param name="defValue">The default value to return if it's not present</param>
        /// <returns>Can return different types: null, boolean, string, array or date</returns>
        public static object GetFieldObjectFromFM(string name, MarkdownFile md, object defValue = null)
        {
            string res = GetFieldValueFromFM(name, md, "");

            if (res == "")
            {
                return(defValue);
            }

            return(TypesHelper.TryToGuessAndConvertToTypeFromString(res));
        }