Hi Wolfgang,
Pablo's solution works, but I tried yours without success. Here are the main lines of my project

%%%% begin product
\startproduct[terminale-manual]
 
\project[terminale-environment]

\startdocument
   
\startfrontmatter
...
\stopfrontmatter
   
\startbodymatter
\component[terminale_recurrence]
...
\stopbodymatter
   
\stopdocument
 
\stopproduct
%%%% end product

%%%% begin project
\startproject[terminale-environment]

\environment[terminale-style]
 ... 
\stopproject
%%%% end project

%%%% begin component
\project[terminale-environment]

\startcomponent[terminale_recurrence]
...
\endcomponent
%%%% end component

%%%% begin environment
\startenvironment[terminale-style]
...
\startsetups [section:chapter]
 
\setuphead
   [chapter]
   [align=flushright,
    textcommand=\groupedcommand{\blank[medium]}{},
    numbercolor=darkgray,
    textstyle=ChapterTextStyle,
    numberstyle=ChapterNumberStyle,
    before=\startChapterFrame,
    after=\stopChapterFrame,
    header=high]

\stopsetups

\startsectionblockenvironment [bodypart]
     \directsetup{section:chapter}
\stopsectionblockenvironment

\doifmode{*component}{\directsetup{section:chapter}}
 
...
\endenvironment
%%%% end environment

Le dim. 15 août 2021 à 19:03, Wolfgang Schuster via ntg-context <ntg-context@ntg.nl> a écrit :
Pablo Rodriguez via ntg-context schrieb am 15.08.2021 um 18:33:
> On 8/15/21 6:02 PM, Fabrice Couvreur via ntg-context wrote:
>> A small note : this method works if I compile the project but if I
>> compile only one chapter, the header no longer appears.
> Hi Fabrice,
>
> I have never used projects and chapters (or whatever the right name is).
>
> I’m not sure I get what you’re experiencing: with a single chapter, do
> you have the fancy layout or not?
>
> It would make sense that the fancy chapter doesn’t appear only compiling
> a chapter. I guess there is no \startbodymatter...\stopbodymatter
> wrapping it.
>
> Another approach would be:
>
> [...]

Setting values for \title is a way to avoid the chapter setup for the
table of contents etc.
but there is a way to set values which are used only when you process a
component file.

To make it work one has to load the environment file after
\startcomponent because you
can use the *component mode to check whether the parent file is a
product or a component.

%%%% begin product
\startproduct [*]

\environment [...]

\startfrontmatter
...
\stopfrontmatter

\startbodymatter
\component [...]
\stopbodymatter

\stopproduct
%%%% end product

%%%% begin component
\startcomponent [*]

\environment [...]

...

\stopcomponent
%%%% end component

%%%% begin environment
\startenvironment [*]

\startsetups [section:chapter]

     \setuphead
         [chapter]
         [...]

\stopsetups

\startsectionblockenvironment [bodypart]
     \directsetup{section:chapter}
\stopsectionblockenvironment

\doifmode{*component}{\directsetup{section:chapter}}

\stopenvironment
%%%% end environment

Wolfgang

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________