How can i identify logically, whether something is the first item on a page, i.e. there is nothing above it (apart from header)?
Consider the following, is is basically a feature environment, which puts a rule above some content, to separate it from anything prior.
Acceptable Output:
\documentclass{article}
\usepackage{lipsum}
\newenvironment{feature}[1]{
\vspace*{\baselineskip}
\hrule
\vspace*{\baselineskip}
\textbf{#1}\\
}{
\vspace*{\baselineskip}
}
\begin{document}
%THIS CASE SHOULD HAVE RULE
\lipsum[1]
\begin{feature}{This is the title}
\lipsum[1]
\end{feature}
\end{document}

However...
If the environment is the only item on a page, or at the top of the page, the rule is not only superfluous, but actually, completely undesirable. How can I switch the rule on / off depending on whether there is content directly above.
Undesirable Output:
\begin{document}
%THIS CASE SHOULD NOT
\newpage
\begin{feature}{This is the title}
\lipsum[1]
\end{feature}
\end{document}

\baselineskipif this is used to separate items. – Heiko Oberdiek May 18 '13 at 01:10