Hugo

Using Html instead of Markdown

I want to use Htlm file instead of .md file. When I edit the HTML file and run the server, Html file code is disapear. Is there any way to use direct Html instead of Markdown file.
I see the @ecarlisle topic but I don’t understand it correctly. I tried a lot of things but it doesn’t work correctly. If I will use

---
url: html-file-path
---

this time css file doesn’t work.

Thank you.

Hi @Caesium. We need more to go to help you. Please read Requesting Help and share your project with your code. Most of the time we figure it out pretty quickly. :slight_smile:

Here’s a working example of a index.html file that is rendered by Hugo:

---
categories: 
  - Creativity
date: 2019-06-13T02:17:12Z
description: "Now, we wait."
draft: false
resources: 
- src: IMG_1742.jpg
  name: "header"
slug:
subtitle: 
summary: " "
title: Chapter X
---

<a style="background-color:black;color:white;text-decoration:none;padding:4px 6px;font-family:-apple-system, BlinkMacSystemFont, &quot;San Francisco&quot;, &quot;Helvetica Neue&quot;, Helvetica, Ubuntu, Roboto, Noto, &quot;Segoe UI&quot;, Arial, sans-serif;font-size:12px;font-weight:bold;line-height:1.2;display:inline-block;border-radius:3px;" href="https://unsplash.com/@tomrdesigns?utm_medium=referral&amp;utm_campaign=photographer-credit&amp;utm_content=creditBadge" target="_blank" rel="noopener noreferrer" title="Download free do whatever you want high-resolution photos from Tom Roberts"><span style="display:inline-block;padding:2px 3px;"><svg xmlns="http://www.w3.org/2000/svg" style="height:12px;width:auto;position:relative;vertical-align:middle;top:-1px;fill:white;" viewBox="0 0 32 32"><title>unsplash-logo</title><path d="M20.8 18.1c0 2.7-2.2 4.8-4.8 4.8s-4.8-2.1-4.8-4.8c0-2.7 2.2-4.8 4.8-4.8 2.7.1 4.8 2.2 4.8 4.8zm11.2-7.4v14.9c0 2.3-1.9 4.3-4.3 4.3h-23.4c-2.4 0-4.3-1.9-4.3-4.3v-15c0-2.3 1.9-4.3 4.3-4.3h3.7l.8-2.3c.4-1.1 1.7-2 2.9-2h8.6c1.2 0 2.5.9 2.9 2l.8 2.4h3.7c2.4 0 4.3 1.9 4.3 4.3zm-8.6 7.5c0-4.1-3.3-7.5-7.5-7.5-4.1 0-7.5 3.4-7.5 7.5s3.3 7.5 7.5 7.5c4.2-.1 7.5-3.4 7.5-7.5z"></path></svg></span><span style="display:inline-block;padding:2px 3px;">Tom Roberts</span></a>

Am I need to copy the all Html and Css, using inside the .md file? There is have to be another way.

Yes, you can use inline styles with <style> or the style= attribute (see @brunoamaral’s example) for (individuall/page-specific) CSS, but styling is usually done in the HTML files located in layouts/… and with CSS files located in the assets folder.

Yes, you can also use HTML in .md files. For HTML-only files I prefer .html files so that indentation is not interpreted by the Markdown processor. Again, see @brunoamaral’s example.