Hi,
Using this (but it's not exactly what I want) it works

test-1.tex %%%%%%%%%%%%%%

\setuppagenumbering
  [alternative=doublesided,location=]

\definelayout
  [1]
  [header=10mm]

\setuplayout
  [header=0pt,
   height=middle]

\setupbackgrounds
   [header]
   [text]
   [frame=off,bottomframe=on,
     framecolor=lightgray,rulethickness=1pt]


\starttext
\dorecurse{5}{\samplefile{lorem}}
%\dorecurse{1}{\samplefile{lorem}}
\stoptext

%%%%%%%%%%%%%%%%%%ù

Using this (almost what I'm trying to do) without success

test-2.tex %%%%%%%%%%%%%
\setuppagenumbering
  [alternative=doublesided,location=]

\setupbackgrounds
  [header]
  [text]
  [frame=off,bottomframe=on,
   framecolor=lightgray,rulethickness=1pt]

\startsetups[header]
  \doifelse{\totalnumberofpages}{1}
    {\setupheadertexts[\setups{header}]}
    {}
\stopsetups


\starttext
\dorecurse{5}{\samplefile{lorem}}
%\dorecurse{1}{\samplefile[lorem]r}
\stoptext

%%%%%%%%%%%%%%%%%%%

Fabrice


Le jeu. 26 août 2021 à 17:56, Wolfgang Schuster via ntg-context <ntg-context@ntg.nl> a écrit :
Taco Hoekwater via ntg-context schrieb am 26.08.2021 um 16:34:
>
> Hi,
>
>> On 26 Aug 2021, at 16:07, Fabrice Couvreur via ntg-context <ntg-context@ntg.nl> wrote:
>>
>> Hi,
>> I know I asked the question a few years ago, but I don't remember !
>> The idea is to test whether the document contains only one page or not.
>
> Perhaps not the nicest solution, but this works:
>
> \doifvalueelse
>    {\lastpage}
>    {1}
>    {\message{true}}
>    {\message{false}}


Same solution but better counter name:

\doifelse{\totalnumberofpages}{1}{...}{...}

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
___________________________________________________________________________________