getnikola / nikola

A static website and blog generator
https://getnikola.com/
MIT License
2.6k stars 446 forks source link

YAML metadata in Pandoc-renderred posts is included in HTML #3601

Open damufo opened 2 years ago

damufo commented 2 years ago

Hello:

Environment

Python Version: 3.5.3

Nikola Version: 8.2.0

Operating System: docker nginx:alpine

Description:

config.py

METADATA_FORMAT = "YAML"

Post source:

---
category: ''
date: 2022-02-24 16:06:27 UTC+01:00
description: ''
link: ''
slug: novo-artigo
tags: ''
title: Título do artigo 3
type: text
---
Escribe o teu artigo aquí.

Metadata is rendered (showed): render_yaml

Very thanks.

Kwpolska commented 2 years ago

Hi, sorry for the late response, but I cannot reproduce this, using Nikola v8.2.0, Ubuntu 20.04, and both reST and Markdown posts, both fresh (nikola new_post) and using code provided by you. Can you verify you’re using a recent version of Nikola and other dependencies?

damufo commented 2 years ago

Hello: Sorry, I've been reviewing the issue and it happens when I use pandoc as a compiler and mix posts in rst and markdown.

Kwpolska commented 2 years ago

This scenario isn’t currently supported, and it might be difficult to add support for it. For pandoc posts, we don’t remove the metadata from compiled posts — this is because our algorithm might delete parts of content in some conditions, and some input formats might lead to metadata not being removed anyway.

If you’re using Markdown and reST, consider using a native compiler instead of Pandoc. If you’re using Pandoc, you’ll need to use the Nikola metadata format and comments appropriate for your input format, or two-file posts.

damufo commented 2 years ago

OK! At the moment two-file posts is my solution. Very thanks!