emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to omit h1 title heading in HTML export?
@ 2013-06-03 17:20 *
  2013-06-04  8:12 ` flammable project
  0 siblings, 1 reply; 5+ messages in thread
From: * @ 2013-06-03 17:20 UTC (permalink / raw)
  To: emacs-orgmode

Dear list

When exporting an Org-mode file to HTML, I have noticed the following:
the first child of the div with id=content is an h1 heading enclosing
the filename (minus extension), or the value of TITLE keyword.

How can I keep HTML export from producing this h1 heading?

For instance say I have a homepage.org file, and that I export this
file to HTML with default settings. In the exported HTML file, I would
find the following snippet:

<body>
<div id="content">
<h1 class="title">homepage</h1>
<div id="table-of-contents">

For what I'm doing, it would be better if the exported file didn't
include the line
<h1 class="title">homepage</h1>

How can I tell HTML export to not put this line in the file that it produces?

At the moment my fix is some CSS...
div#content > h1:first-child { display: none; }

I'm using Org-mode version 8.0.3, Emacs 24.3.1

Best...

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to omit h1 title heading in HTML export?
  2013-06-03 17:20 How to omit h1 title heading in HTML export? *
@ 2013-06-04  8:12 ` flammable project
  2013-06-04 17:16   ` *
  0 siblings, 1 reply; 5+ messages in thread
From: flammable project @ 2013-06-04  8:12 UTC (permalink / raw)
  To: *; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1095 bytes --]

Hi,

Here is what I usely do, I ommit (left blank) the content beside the
#+TITLE: option.

Maybe it will help you!

Regards,

Basile


2013/6/3 * <viki.veeks@gmail.com>

> Dear list
>
> When exporting an Org-mode file to HTML, I have noticed the following:
> the first child of the div with id=content is an h1 heading enclosing
> the filename (minus extension), or the value of TITLE keyword.
>
> How can I keep HTML export from producing this h1 heading?
>
> For instance say I have a homepage.org file, and that I export this
> file to HTML with default settings. In the exported HTML file, I would
> find the following snippet:
>
> <body>
> <div id="content">
> <h1 class="title">homepage</h1>
> <div id="table-of-contents">
>
> For what I'm doing, it would be better if the exported file didn't
> include the line
> <h1 class="title">homepage</h1>
>
> How can I tell HTML export to not put this line in the file that it
> produces?
>
> At the moment my fix is some CSS...
> div#content > h1:first-child { display: none; }
>
> I'm using Org-mode version 8.0.3, Emacs 24.3.1
>
> Best...
>
>

[-- Attachment #2: Type: text/html, Size: 1779 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to omit h1 title heading in HTML export?
  2013-06-04  8:12 ` flammable project
@ 2013-06-04 17:16   ` *
  2013-06-04 17:24     ` Rasmus
  0 siblings, 1 reply; 5+ messages in thread
From: * @ 2013-06-04 17:16 UTC (permalink / raw)
  To: flammable project; +Cc: emacs-orgmode

Hey Basile
Thanks for your reply!

Yes, the suggestion helps :-)
A blank TITLE option seems to produce some empty tags like so:
<h1 class="title"></h1>

And maybe there are also some jquery fixes, for instance...
$("#content h1:first-child").hide();

Sometimes tricks are fun,
but I guess one of my questions was: Do all documents generated by
HTML export contain the <h1 class="title">blabla</h1> markup?

Best,
Ivan

On 6/4/13, flammable project <flammable.project@gmail.com> wrote:
> Hi,
>
> Here is what I usely do, I ommit (left blank) the content beside the
> #+TITLE: option.
>
> Maybe it will help you!
>
> Regards,
>
> Basile
>
>
> 2013/6/3 * <viki.veeks@gmail.com>
>
>> Dear list
>>
>> When exporting an Org-mode file to HTML, I have noticed the following:
>> the first child of the div with id=content is an h1 heading enclosing
>> the filename (minus extension), or the value of TITLE keyword.
>>
>> How can I keep HTML export from producing this h1 heading?
>>
>> For instance say I have a homepage.org file, and that I export this
>> file to HTML with default settings. In the exported HTML file, I would
>> find the following snippet:
>>
>> <body>
>> <div id="content">
>> <h1 class="title">homepage</h1>
>> <div id="table-of-contents">
>>
>> For what I'm doing, it would be better if the exported file didn't
>> include the line
>> <h1 class="title">homepage</h1>
>>
>> How can I tell HTML export to not put this line in the file that it
>> produces?
>>
>> At the moment my fix is some CSS...
>> div#content > h1:first-child { display: none; }
>>
>> I'm using Org-mode version 8.0.3, Emacs 24.3.1
>>
>> Best...
>>
>>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to omit h1 title heading in HTML export?
  2013-06-04 17:16   ` *
@ 2013-06-04 17:24     ` Rasmus
  2013-06-05 18:48       ` *
  0 siblings, 1 reply; 5+ messages in thread
From: Rasmus @ 2013-06-04 17:24 UTC (permalink / raw)
  To: emacs-orgmode

"*" <viki.veeks@gmail.com> writes:

> Hey Basile
> Thanks for your reply!
>
> Yes, the suggestion helps :-)
> A blank TITLE option seems to produce some empty tags like so:
> <h1 class="title"></h1>
>
> And maybe there are also some jquery fixes, for instance...
> $("#content h1:first-child").hide();
>
> Sometimes tricks are fun,
> but I guess one of my questions was: Do all documents generated by
> HTML export contain the <h1 class="title">blabla</h1> markup?

Yes seems like it.  check ox-html.el and org-html--build-meta-info.

If you are very unhappy with blank title solution proposed by
Bastien you could use a filter.  Here's a filter I use for headlines;
you can easily adapt it to your case:

(defun rasmus/org-html-ignore-title-if-present (string backend info)
    "Strip title if it's already there for html."
    (when (and (org-export-derived-backend-p backend 'html)
               (string-match "h1 class=\"mytitle\"" string))
      (replace-regexp-in-string "<h1 class=\"title\">.*?</h1>" "" string)))

(add-to-list 'org-export-filter-final-output-functions
             'rasmus/org-html-ignore-title-if-present)




-- 
I hear there's rumors on the, uh, Internets. . .

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to omit h1 title heading in HTML export?
  2013-06-04 17:24     ` Rasmus
@ 2013-06-05 18:48       ` *
  0 siblings, 0 replies; 5+ messages in thread
From: * @ 2013-06-05 18:48 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

On 6/4/13, Rasmus <rasmus@gmx.us> wrote:
> "*" <viki.veeks@gmail.com> writes:
>
>> Hey Basile
>> Thanks for your reply!
>>
>> Yes, the suggestion helps :-)
>> A blank TITLE option seems to produce some empty tags like so:
>> <h1 class="title"></h1>
>>
>> And maybe there are also some jquery fixes, for instance...
>> $("#content h1:first-child").hide();
>>
>> Sometimes tricks are fun,
>> but I guess one of my questions was: Do all documents generated by
>> HTML export contain the <h1 class="title">blabla</h1> markup?
>
> Yes seems like it.  check ox-html.el and org-html--build-meta-info.
>
> If you are very unhappy with blank title solution proposed by
> Bastien you could use a filter.  Here's a filter I use for headlines;
> you can easily adapt it to your case:
>
> (defun rasmus/org-html-ignore-title-if-present (string backend info)
>     "Strip title if it's already there for html."
>     (when (and (org-export-derived-backend-p backend 'html)
>                (string-match "h1 class=\"mytitle\"" string))
>       (replace-regexp-in-string "<h1 class=\"title\">.*?</h1>" "" string)))
>
> (add-to-list 'org-export-filter-final-output-functions
>              'rasmus/org-html-ignore-title-if-present)
>
>
>
>
> --
> I hear there's rumors on the, uh, Internets. . .
>
>
>


Thanks for your reply!
Yes, perhaps this is what I was looking for :-)

See below for the snippet that I added to the publishing configuration file.
Modulo very small tweaks, it's your snippet... errors are mine...

In the configuration file I also have to now explicitly say (require 'ox-html)

I'm new at this, so perhaps I ask more questions: Should filters be
defined in the publishing configuration file, like I've done?

(require 'ox-html)
(defun rasmus/org-html-ignore-title-if-present (string backend info)
  "Strip title if it's already there for html."
  (when (and (org-export-derived-backend-p backend 'html)
	     (string-match "h1 class=\"title\"" string))
    (replace-regexp-in-string "<h1 class=\"title\">.*?</h1>\n+" "" string)))

(add-to-list 'org-export-filter-final-output-functions
	     'rasmus/org-html-ignore-title-if-present)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-06-05 18:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-03 17:20 How to omit h1 title heading in HTML export? *
2013-06-04  8:12 ` flammable project
2013-06-04 17:16   ` *
2013-06-04 17:24     ` Rasmus
2013-06-05 18:48       ` *

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).