We report a high-resolution x-ray scattering study of the smectic liquid crystal octylcyanobiphenyl (8CB) confined to aligned colloidal aerosil gels. The aligned gels introduce orientational fields that promote long-range nematic order while imposing positional random fields that couple to the smectic density wave and disrupt the formation of an ordered smectic phase. At low densities of aerosil, the low-temperature scattering intensity is consistent with the presence of a topologically ordered XY Bragg glass phase that is predicted to form in response to such anisotropic quenched disorder. The observed features of the phase include an algebraic decay of the smectic correlations, which is truncated at large length scales due to the imperfect nematic order, and a power-law exponent that agrees closely with the universal value predicted for the XY Bragg glass. At higher aerosil densities, deviations from the XY Bragg glass form are apparent. At high temperature, the scattering intensity displays pre-transitional dynamic fluctuations associated with the destroyed nematic to smectic-A transition. The fluctuations obey quasi-critical behavior over an extended range of reduced temperature. The effective critical exponents for the correlation lengths and smectic susceptibility differ systematically from those of pure 8CB, indicating that coupling of the nematic order to the gel suppresses its role in the smectic critical behavior.